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

2013-04-19 Thread Liviu Andronic
] avoid losing data.frame attributes on cbind() 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

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

2013-04-19 Thread arun
3 3 3 4 4 3 3 3 3 ... # - attr(*, label)= chr Some df label A.K. - Original Message - From: Liviu Andronic landronim...@gmail.com To: arun smartpink...@yahoo.com Cc: R help r-help@r-project.org Sent: Friday, April 19, 2013 8:13 AM Subject: Re: [R] avoid losing data.frame attributes

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

2013-04-19 Thread Liviu Andronic
A.K. - Original Message - From: Liviu Andronic landronim...@gmail.com To: arun smartpink...@yahoo.com Cc: R help r-help@r-project.org Sent: Friday, April 19, 2013 8:13 AM Subject: Re: [R] avoid losing data.frame attributes on cbind() Dear Arun, On Tue, Apr 16, 2013 at 10:45

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

2013-04-16 Thread Liviu Andronic
Dear all, How should I add several variables to a data frame without losing the attributes of the df? Consider the following: require(Hmisc) Xa - iris label(Xa, self=T) - Some df label str(Xa) 'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9

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

2013-04-16 Thread arun
...  #- attr(*, label)= chr Some df label A.K. - Original Message - From: Liviu Andronic landronim...@gmail.com To: r-help r-h...@stat.math.ethz.ch Cc: Sent: Tuesday, April 16, 2013 2:24 PM Subject: [R] avoid losing data.frame attributes on cbind() Dear all, How should I add several

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

2013-04-16 Thread arun
... # - attr(*, label)= chr Some df label A.K. - Original Message - From: arun smartpink...@yahoo.com To: Liviu Andronic landronim...@gmail.com Cc: R help r-help@r-project.org Sent: Tuesday, April 16, 2013 2:40 PM Subject: Re: [R] avoid losing data.frame attributes on cbind() HI, Not sure

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

2013-04-16 Thread arun
. - Original Message - From: arun smartpink...@yahoo.com To: Liviu Andronic landronim...@gmail.com Cc: R help r-help@r-project.org 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- NA Xc