[R] subset and "or" operator

lauramorgana at bluewin.ch lauramorgana at bluewin.ch
Mon Mar 23 11:27:35 CET 2009


Hello,
I'm trying to subset a dataframe where I have many observation taken in different years.
I would like to subset the dataframe (in this example called "table") to get a new dataframe containing only the 
observation of year 1995, 1998 and 2000.
I've tried to use subset and the or operator "|" like this:
subset(table, year==1995|1998|2000)-->table2
but the dataframe didn't subset and I get an object called table2 that is identical to table.
I guess I'm doing something wrong!!

Thank in advance for any suggestions!
Laura




More information about the R-help mailing list