Hi all,

I am having a bit of trouble using the levels() function.
I have a factor with many elements, and when I use the function levels() to
extract the list of unique elements, some of the elements returned are not
actually in the factor.

For example I would have this:

> vector <- dataset$Benchmark
> class(vector)
[1] "factor"
> length(vector)
[1] 35615
> vector2 <- levels(vector)
> length(which(!(vector2 %in% vector)))
[1] 235

Does anyone know how this is possible?

Many thanks!

Borja

        [[alternative HTML version deleted]]

______________________________________________
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