The filter verb can be used to extract a subset of rows matching the filter criteria, as shown:
# Filter states with < 1% Illiteracy (i.e., > 99% literacy) filter(tstate, Illiteracy < 1) # Equivalently -> filter(tstate, (100 - Illiteracy) > 99) # Filter states with < 1% Illiteracy and Income > the mean Income of all states # We will apply the AND condition using & filter(tstate, Illiteracy < 1 & Income > mean(Income)) # This is the same as using , (comma), multiple parameters are treated as AND identical(filter(tstate, Illiteracy < 1 & Income > mean(Income)),filter(tstate, Illiteracy < 1, Income > mean(Income))) # [1] TRUE # Filter states with Income > the mean Income of all states OR HS Graduation Rate > 60% # We will ...