Possible Duplicate:
Standard way to remove multiple elements from a dataframe
I know in R that if you are searching for a subset of another group or matching based on id you'd use something like
subset(df1, df1$id %in% idNums1)
My question is how to do the opposite or choose items NOT matching a vector of ids.
I tried using !
but get the error message
subset(df1, df1$id !%in% idNums1)
I think my backup is to do sometime like this:
matches <- subset(df1, df1$id %in% idNums1)
nonMatches <- df1[(-matches[,1]),]
but I'm hoping there's something a bit more efficient.