Re: [R] factor with numeric names

2011-03-25 Thread agent dunham
Dear all, According to the post I was trying: factorA = c(2,2,3,3,4,4,3,4,2,2) levels(factor - c(lv1,lv2,lv3) ) But this returns NULL and doesn't change factor names. Actually, my factor is included in a data.frame, so I also tried: levels(df$factorA)[levels(df$factorA)==2] - lv1 Also

Re: [R] factor with numeric names

2011-03-25 Thread agent dunham
Dear all, According to the post I was trying: factorA = c(2,2,3,3,4,4,3,4,2,2) levels(factorA - c(lv1,lv2,lv3) ) But this returns NULL and doesn't change factor names. Actually, my factor is included in a data.frame, so I also tried: levels(df$factorA)[levels(df$factorA)==2] - lv1 Also

Re: [R] factor with numeric names

2011-03-25 Thread David Winsemius
On Mar 25, 2011, at 8:30 AM, agent dunham wrote: Dear all, According to the post I was trying: factorA = c(2,2,3,3,4,4,3,4,2,2) levels(factorA - c(lv1,lv2,lv3) ) Well, this is wrong. Try: levels(factorA) - c(lv1,lv2,lv3) factorA [1] 2 2 3 3 4 4 3 4 2 2 attr(,levels) [1] lv1 lv2 lv3

Re: [R] factor with numeric names

2009-03-25 Thread Saiwing Yeung
-21-09 5:02 PM To: r-help@r-project.org Subject: [R] factor with numeric names Hi all, I have a pretty basic question about categorical variables but I can't seem to be able to find answer so I am hoping someone here can help. I found that if the factor names are all in numbers, fitting

[R] factor with numeric names

2009-03-21 Thread Saiwing Yeung
Hi all, I have a pretty basic question about categorical variables but I can't seem to be able to find answer so I am hoping someone here can help. I found that if the factor names are all in numbers, fitting the model in lm would return labels that are not very recognizable. # Example:

Re: [R] factor with numeric names

2009-03-21 Thread John Fox
this helps, John -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Saiwing Yeung Sent: March-21-09 5:02 PM To: r-help@r-project.org Subject: [R] factor with numeric names Hi all, I have a pretty basic question about categorical

Re: [R] factor with numeric names

2009-03-21 Thread Tal Galili
Hi Saiwing, If all you are asking is how to rename a factor vector, the easiest way would be to use: levels(Loblolly$Seed) - c( a vector of level names you would like to use for the factor - separated by commas) If you are asking how to make your output look better, I am not sure I have an idea