This function applies a set of filters to a dataset. Each filter specifies a column,
condition, and value to filter the dataset.
apply_filters(raw_data, filters)
Arguments
- raw_data
A data frame containing the raw data to be filtered.
- filters
A list of filters, where each filter is a list containing
the column, condition, and value.
Value
A data frame containing the filtered data.
Details
The function iterates over the list of filters and applies each filter to the dataset.
The supported conditions are ==
, >
, <
, >=
, and <=
.
Examples
if (FALSE) { # \dontrun{
# Example usage:
raw_data <- mtcars
filters <- list(
filter1 = list(column = "mpg", condition = ">", value = "20"),
filter2 = list(column = "cyl", condition = "==", value = "6")
)
filtered_data <- apply_filters(raw_data, filters)
} # }