Skip to contents

Filter a DataFrame based on the specified filter list.

Usage

filter_dataframe(df, filter_list)

Arguments

df

The DataFrame to be filtered

filter_list

A list specifying the filters to be applied

Value

The filtered DataFrame

Examples

# Create a DataFrame
df <- data.frame(ID = c(1, 2, 3, 4),
                 Name = c("John", "Jane", "Mike", "Sarah"),
                 Age = c(25, 30, 28, 32),
                 Gender = c("Male", "Female", "Male", "Female"))

# Create a filter list
filter_list <- list(Name = c("John", "Mike"), Age = c(25, 28))

# Filter the DataFrame
filter_dataframe(df, filter_list)
#>   ID Name Age Gender
#> 1  1 John  25   Male
#> 3  3 Mike  28   Male