Re: [R] levels() function for a vector

2008-03-11 Thread Richard Pearson
Karen levels returns the levels attribute of a variable, and a vector has no such attribute. This is usually used with a factor, e.g. temp - c(3, 5, 5, NA) levels(factor(temp)) [1] 3 5 Best wishes Richard Chang Liu wrote: Hello: I'm trying to use levels function, but I don't know

[R] levels() function for a vector

2008-03-10 Thread Chang Liu
Hello: I'm trying to use levels function, but I don't know why it's returning NULL. For example: temp[1] 3 5 5 NA levels(temp)NULL Also, I've tried: list(temp)[[1]][1] 3 5 5 NA levels(list(temp))NULL Is there a specific requirement on the parameter? Karen