Dieter Menne wrote:


Henrik Wahren wrote:
How can one or more levels be removed from a factor of a data frame. There
was a similar post on how to do this when a factor meets some criterion
(e.g. <= 2), but I canĀ¹t seem to get that solution to work.
Here, I simply want to drop some levels.



Simply call factor again on the reduced set

a = factor(c("a","b","b","b"))
a[-1]
factor(a[-1])

If a is in a data frame, replace a by by df$a.



or  a[-1, drop=TRUE]

Uwe Ligges

Dieter

______________________________________________
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