Skip to contents

Filters out columns from a data frame that have a higher percentage of NA values than the specified threshold.

Usage

filter_na_columns(df, max_na_percent = 0.2)

Arguments

df

A data frame.

max_na_percent

Maximum allowed proportion of NA values per column. Default is 0.2.

Value

A data frame with filtered columns.

Examples

filter_na_columns(data.frame(a = c(1, NA, 3), b = c(NA, NA, 3)), max_na_percent = 0.5)
#>    a
#> 1  1
#> 2 NA
#> 3  3