Skip to content
Prev 303022 / 398503 Next

subsetting levels of a vector

On Aug 10, 2012, at 4:07 AM, simona mancini <mancinisimona at yahoo.it> wrote:

            
Take a look at ?subset and ?"%in%, which can be used in this fashion:

  NewDF <- subset(DF, Electrode %in% c("FP1", "FP2", "F4"))

If the levels you do not want are few in number, it may be easier to use:

  NewDF <- subset(DF, !Electrode %in% c("Levels", "You", "Don't", "Want"))

Note the use of '!' before Electrode to negate the boolean logic.

Regards,

Marc Schwartz