[R] Creating subsets with factors

Sven Garbade garbade at psy.uni-muenchen.de
Wed Jan 9 11:59:45 CET 2002


Hi all,

I don't understand the following output. I've created a data subset from
a data frame by

> p1.sub <- subset(p1.dat, vp!="p1")

this is ok. But 

> attach(p1.sub)
> vp
 [1] p1ab p1ab p1ab p1ab p1ab p1br p1br p1br p1br p1br p1kf p1kf p1kf
p1kf p1kf
[16] p1mg p1mg p1mg p1mg p1mg p1mw p1mw p1mw p1mw p1mw
Levels:  p1 p1ab p1br p1kf p1mg p1mw 

shows me that the factor vp has 6 levels instead of 5? 5 should be the
correct number of levels, because p1 isn't in the data subset.

Thanks, Sven
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list