] 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
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
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
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 ...
# $
...
# - 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
.
- 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
6 matches
Mail list logo