first_match_col.Rd`first_match_col()` finds the first matching column in a dataframe
first_match_col(x, pattern, how = c("all", "any"))A dataframe
A pattern to match
How to match the pattern (all or any)
The name of the first matching column
data <- data.frame(a = c("a", "b", "c"), b = c("a", " ", "c"), c = c("a", "b", "1"))
first_match_col(data, "\\D", "all")
#> [1] "a"
first_match_col(data, "\\d", "any")
#> [1] "c"