Hi
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of maths123
Sent: Monday, November 26, 2012 8:25 PM
To: r-help@r-project.org
Subject: Re: [R] Factor function for coded numerical values
The question says
The question says that there is an experiement to investigate the effect on
breathing rate when doing different types of exercise with wearing more
clothes or less clothes (factor A, coded 1,2).
The duration of exercise was 10min, 20min, 30min (factor B, coded 1,2,3).
Could you give m anymore
Le jeudi 22 novembre 2012 à 13:12 -0800, maths123 a écrit :
I have s data set where 2 of the columns give the coded versions of the
factors A and B. Factor A is coded with 1, 2, 3. Factor B is coded with 1,2.
How do use the factor function to convert these variables into factors, and
also
I have s data set where 2 of the columns give the coded versions of the
factors A and B. Factor A is coded with 1, 2, 3. Factor B is coded with 1,2.
How do use the factor function to convert these variables into factors, and
also use the labels= command to give them a more informative name?
Hi
d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA),
ncol=3, byrow=TRUE))
Change character value NA to missing value NA
d[d[,3]==NA,3]-NA
If you want drop any unused levels of a factor just use
factor(d[,3])
[1] xx yy NA
Levels: xx yy
Regards
Petr
r-help-boun...@r-project.org napsal
Thank you so much!
Lisa
--
View this message in context:
http://r.789695.n4.nabble.com/Factor-function-tp3473984p3475549.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
On Tue, Apr 26, 2011 at 10:51:33AM +0200, Petr PIKAL wrote:
Hi
d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA),
ncol=3, byrow=TRUE))
Change character value NA to missing value NA
d[d[,3]==NA,3]-NA
If you want drop any unused levels of a factor just use
factor(d[,3])
[1] xx
On Apr 26, 2011, at 18:52 , Petr Savicky wrote:
On Tue, Apr 26, 2011 at 10:51:33AM +0200, Petr PIKAL wrote:
Hi
d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA),
ncol=3, byrow=TRUE))
Change character value NA to missing value NA
d[d[,3]==NA,3]-NA
If you want drop any unused
Dear All,
I just want to remove “NA” from the levels of a factor. For example:
d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA),
ncol=3, byrow=TRUE))
factor(d[, 3], exclude=NA)
[1] xx yy NA
Levels: NA xx yy
But “NA” is still listed in the levels. How can I solve this problem? Thanks
in
Hi Lisa,
NA != NA
The first represents a missing observation, the second represents a
character string.
HTH,
Ista
On Mon, Apr 25, 2011 at 3:53 PM, Lisa lisa...@gmail.com wrote:
Dear All,
I just want to remove “NA” from the levels of a factor. For example:
Did you see the data frame d? Thanks.
--
View this message in context:
http://r.789695.n4.nabble.com/Factor-function-tp3473984p3474065.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
Yes... did you understand that NA is not equal to NA?
Best,
Ista
On Mon, Apr 25, 2011 at 4:31 PM, Lisa lisa...@gmail.com wrote:
Did you see the data frame d? Thanks.
--
View this message in context:
http://r.789695.n4.nabble.com/Factor-function-tp3473984p3474065.html
Sent from the R help
Thank you for your reply again. I really know that NA is not NA. I just
want to figure out how to remove NA from the levels. Thanks again.
--
View this message in context:
http://r.789695.n4.nabble.com/Factor-function-tp3473984p3474127.html
Sent from the R help mailing list archive at
On Mon, Apr 25, 2011 at 12:53:40PM -0700, Lisa wrote:
Dear All,
I just want to remove “NA” from the levels of a factor. For example:
d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA),
ncol=3, byrow=TRUE))
factor(d[, 3], exclude=NA)
[1] xx yy NA
Levels: NA xx yy
But “NA” is still
Thank you for your help. Your R code works well.
Lisa
--
View this message in context:
http://r.789695.n4.nabble.com/Factor-function-tp3473984p3474196.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
15 matches
Mail list logo