Extract rows from R data frame based on factors (strings) Try using the subset function. This site provides a good reference: HowtoInR my_data = subset(my_data, gender == "male")