Re: [R] To transform a vector of qualitatives values into a dataframe of quantitatives values

2013-12-11 Thread Andrea Spano
Petr wrote: > >> Hi >> >> -Original Message- >>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >>> project.org] On Behalf Of Arnaud Michel >>> Sent: Wednesday, December 11, 2013 2:01 PM >>> To: R help >>> Subject:

Re: [R] To transform a vector of qualitatives values into a dataframe of quantitatives values

2013-12-11 Thread Duncan Murdoch
On 13-12-11 8:22 AM, PIKAL Petr wrote: Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Arnaud Michel Sent: Wednesday, December 11, 2013 2:01 PM To: R help Subject: [R] To transform a vector of qualitatives values into a

Re: [R] To transform a vector of qualitatives values into a dataframe of quantitatives values

2013-12-11 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Arnaud Michel > Sent: Wednesday, December 11, 2013 2:01 PM > To: R help > Subject: [R] To transform a vector of qualitatives values into a > dataframe of

[R] To transform a vector of qualitatives values into a dataframe of quantitatives values

2013-12-11 Thread Arnaud Michel
Hi From the vector X <- c(A, A, B, C, B, A, C) I would like to build the Dataframe : data.frame( A=c(1,1,0,0,0,1,0), B=c(0,0,1,0,1,0,0), C=c(0,0,0,1,0,0,1)) Any ideas ? -- Michel ARNAUD Chargé de mission auprès du DRH DGDRD-Drh - TA 174/04 Av Agropolis 34398 Montpellier cedex 5 tel : 04.67.61

Re: [R] To transform a vector

2013-12-08 Thread Arnaud Michel
Thank you Michel Le 09/12/2013 08:14, Berend Hasselman a écrit : On 09-12-2013, at 08:04, Arnaud Michel wrote: Dear R Users I have the vector X <- c( 6 , 4 ,12 , 3) I would like to build a new vector by to transform it into Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep(X[4],

Re: [R] To transform a vector

2013-12-08 Thread Pascal Oettli
Hello, Are you looking for Y <- rep(X, X) ? Regards, Pascal On 9 December 2013 16:04, Arnaud Michel wrote: > Dear R Users > > I have the vector > X <- c( 6 , 4 ,12 , 3) > > I would like to build a new vector by to transform it into > Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep

Re: [R] To transform a vector

2013-12-08 Thread Berend Hasselman
On 09-12-2013, at 08:04, Arnaud Michel wrote: > Dear R Users > > I have the vector > X <- c( 6 , 4 ,12 , 3) > > I would like to build a new vector by to transform it into > Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep(X[4], X[4])) > > Have you a more elegant answer ? Have a

[R] To transform a vector

2013-12-08 Thread Arnaud Michel
Dear R Users I have the vector X <- c( 6 , 4 ,12 , 3) I would like to build a new vector by to transform it into Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep(X[4], X[4])) Have you a more elegant answer ? PS : Sorry for this basic question -- Michel ARNAUD Chargé de mission au