Given mydata
as follows:
set.seed(1)
mydata <- data.frame(item=rep(100:400,each=20), RT=sample(0:100,6020, replace=T))
Then the following all produce the same thing:
to.delete <- mydata$item %in% c(111,114,222,319) # two steps
scrubbed.1 <- mydata[!to.delete,]
scrubbed.2 <- mydata[!(mydata$item %in% c(111,114,222,319)),] # same, one step
# @MatthewLundberg's approach (he left out a comma before the right bracket...]
scrubbed.3 <- droplevels(mydata[!(mydata$item %in% c(111,114,222,319)),])
identical(scrubbed.1,scrubbed.2)
# [1] TRUE
identical(scrubbed.1,scrubbed.3)
# [1] TRUE
Your first approach failed because you were comparing df$item
to a string "111, 114, 222, 319". None of the items match that string, hence no deletions.