[R] subset problem (reducing from six to two levels)

Stephan Kolassa Stephan.Kolassa at gmx.de
Thu Feb 5 22:53:16 CET 2009


Hi,

does this help?

http://www.nabble.com/factor-question-to18638814.html#a18638814

HTH,
Stephan


Ine schrieb:
> Hi all,
> I have got a seemingly simple problem (I am an R starter) with subsetting my
> data set, but cannot figure out the solution: I want to subset a data set
> from six to two levels, so that all analyses are done only with these two
> remaining levels.
> I tried
> 
> TOTAL<-read.delim('total.csv',header=T)
> SUBSET.OF.TOTAL<-subset(TOTAL, FactorX %in% c("Level1","Level2"))
> attach(SUBSET.OF.TOTAL)
> 
> but R does not eliminate the remaining levels of FactorX, just assigns 'not
> available' to the data. Like this, the other levels still show up in plots
> etc., but without data entries. Anybody got a solution how to subset the
> data so that I eliminate the other levels completely?
> 
> Thanks a lot for the help,
>




More information about the R-help mailing list