Possible Duplicate:
Standard way to remove multiple elements from a dataframe
I have a large data frame that an example from looks like this:
[df]
Sample Assay Genotype X
001 001 T 2356
002 001 C 1892
001 004 T 8
002 004 C 11567
1001 004 T 8385
1001 005 A 604
In all the data frame has over 330,000 rows of data.
I am trying to remove certain rows from this data frame based using the values for X which is unique for each row. I have the list of values for X that id like to remove as an object in the 'integer' clas. In this example, id like to remove rows that match 'z':
z = 1892 8 604
This would result in a new data frame for this example:
[df]
Sample Assay Genotype X
001 001 T 2356
002 004 C 11567
1001 004 T 8385
Im really not sure how to go about this, although im sure its quite basic. In my real data, the list for z
is quite long, so I cant simply write out allow of the values id like to remove into the code.
I tried df[df$X !=z, , drop=F]
and this didnt work. Im not sure how to use the removal list on the larger data frame.