Doing ?factor I get:

x a vector of data, usually taking a small number of distinct values. 
levels an optional vector of the values that x might have taken. The default is 
the set of values taken by x, sorted into increasing order. 

So if I do:

factor(letters[1:20],level=seq(1:20)
 [1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
[16] <NA> <NA> <NA> <NA> <NA>
Levels: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

So why all of the NA? What happend to 'a'. 'b', etc.? I was expecting a=1, b=2, 
c=3 etc.

I am missing something. Please help with my understanding. 

Keviin

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to