The dplyr::filter function allows you to limit your dataset to observations (rows) meeting a specific criteria. Multiple criteria can be combined with the & (AND) and | (OR) symbols.
library(dplyr)data("starwars")# select femalesnewdata <-filter(starwars, gender =="feminine")# select females that are from Alderaannewdata <-filter(starwars, gender =="feminine"& homeworld =="Alderaan")