Re: [R] avoid losing data.frame attributes on cbind()

2013-04-19 Thread Liviu Andronic
3.9 3.4 3.4 2.9 3.1 ... > # $ : num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... > # $ : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... > # $ : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ... > # $ : num 5 5 5 5 5 5 5 5 4 5 ... > # $ : num

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-19 Thread arun
w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ... # $ : num  5 5 5 5 5 5 5 5 4 5 ... # $ : num  4 3 3 3 4 4 3 3 3 3 ... # - attr(*, "label")= chr "Some df label" A.K. - Original Message - From: Liviu Andronic To: arun Cc: R help

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-19 Thread Liviu Andronic
r",..: 1 1 1 1 1 1 1 > 1 1 1 ... > # $ var1: num 5 5 5 5 5 5 5 5 4 5 ... > # $ var2: num 4 3 3 3 4 4 3 3 3 3 ... > # - attr(*, "label")= chr "Some df label" > A.K. > > > > ----- Original Message - > From: arun > To: Liviu

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-16 Thread arun
"label")= chr "Some df label" A.K. - Original Message - From: arun To: Liviu Andronic Cc: R help Sent: Tuesday, April 16, 2013 4:45 PM Subject: Re: [R] avoid losing data.frame attributes on cbind() Hi, Another method would be: Xc<- Xa  Xc$var1<-NA; Xc$var2<-

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-16 Thread arun
# $ var2    : num  4 3 3 3 4 4 3 3 3 3 ... # - attr(*, "label")= chr "Some df label" A.K. - Original Message - From: arun To: Liviu Andronic Cc: R help Sent: Tuesday, April 16, 2013 2:40 PM Subject: Re: [R] avoid losing data.frame attributes on cbind() HI, N

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-16 Thread arun
HI, Not sure if this helps: library(plyr) res<-mutate(Xa,var1=round(Sepal.Length),var2=round(Sepal.Width)) str(res) #'data.frame':    150 obs. of  7 variables: # $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... # $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... # $ Petal.L