I have a data frame with 26 columns and 1000 rows. I have a list of 20 values. I'd like to select only the rows in the data frame that contain any (one or more) of the values on my list.
I have tried subset, and subset + filter functions. Here is the list of values:
dx.codes <- c(4140 , 4111 , 4118 , 41181 , 41189 , 412 , 4130 , 4131 , 4139 , 4140 , 41400 , 41401 , 41406 , 4142 , 4143 , 4144 , 4148 , 4149 , "V4581", "V4582")
df <- subset(sample.df, subset.df[1:1000, ] %in% dx.codes)
That subset returns a new data frame, but without any observations. Looking at the initial data frame I know there are rows containing those values, however I can't get them to show up in the new data frame.