How to remove subsets of data from my data frame

I have a large dataset with 5,158,407 entries and 87 variables. I would like to select a subset of the entries (rows) which correspond with three categories within one of the variables.

Let's say your data frame is called DF and you want to keep those rows that have the value A, B or C in the column called Group.

library(dplyr)
DF_filtered <- filter(DF, Group %in% c("A", "B", "C"))

If you cannot adapt that example to what you want to do, please explain in more detail what you need to accomplish.

1 Like