[R] Filter out some levels?
Douglas Bates
bates at stat.wisc.edu
Tue Feb 24 15:45:29 CET 2004
Christian Schulz <ozric at web.de> writes:
> how is it possible to cut some levels from one factor to subsetting a
> data.frame on?
>
> subdata <- subset(data, data$FACTOR="1" |
> data$FACTOR="BETA" | data$FACTOR="XY")
> ???
>
> Maybe a modifcation here is better, but how?
> mergex[mergex$PLZX %in% levels(mergex$PLZX) ,]
Use %in%
subdata <- subset(data, FACTOR %in% c("1", "BETA", "XY"))
More information about the R-help
mailing list