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]

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"] <-

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

Re: [R] factor with numeric names

2009-03-25 Thread Saiwing Yeung
Thank you so much both for the answer. I think I have a better handle on this now. Yes, Loblolly$Seed is an ordered factor, but I didn't realize that the default for ordered factor is contr.poly. And then I was further confused because I didn't realize the coefficient names generated (not

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 (

Re: [R] factor with numeric names

2009-03-21 Thread John Fox
Dear Saiwing Yeung, You appear to be using orthogonal-polynomial contrasts (generated by contr.poly) for Seed, which suggests that Seed is either an ordered factor or that you've assigned these contrasts to it. Because Seed has 14 levels, you end up fitting an degree-13 polynomial. If Seed is inde