Provides a simple yet efficient way to drop missing values("NA"s) at columns that match a given pattern.
drop_na_at(
df,
pattern_type = "contains",
pattern = NULL,
case_sensitive = FALSE,
...
)
A data.frame object
One of "contains", "ends_with" or "starts_with"
The type of pattern to use when matching the pattern_type. The pattern is case sensitive
Defaults to FALSE. Patterns are case insensitive if TRUE
Other params to other methods
A data.frame object containing only columns that match the given pattern with the missing values removed.
head(drop_na_at(airquality,pattern_type = "starts_with","O"))
#> Ozone
#> 1 41
#> 2 36
#> 3 12
#> 4 18
#> 5 28
#> 6 23