Subset data frame for a term in a specified column.

subset_df(df, col.filter, filter_for = "Yes")

Arguments

df

Data frame to subset.

col.filter

String. Name of column to filter.

filter_for

String. Term to filter for.

Value

Data frame, subset for rows where filter_for was present in col.filter.

Details

Subset data frame for a term in a specified column. subset_df() filters a data frame for a certain term in a specified column. All rows containing the term in the specified column are kept, while the other rows are silently dropped. Here, col.filter is a string rather than a symbol to facilitate filtering in columns that carry special characters such as '-' in their name.

See also