Description Usage Arguments Details Value Examples
match_cols
returns matching column names from a table. The matching
is performed using regular expressions and grepl.
1 | match_cols(tbl, patt, ...)
|
tbl |
A tibble or dataframe. |
patt |
Regular expression pattern to pass to grepl. |
... |
Parameters to pass along to grepl. |
Ignores case by default. Can be overridden by passing ignore.case
via
...
.
A character vector of column names matching the regex.
1 2 3 4 5 6 7 8 9 10 11 12 | ## dataframe to convert
key <- c(1000L, 2000L, 3000L, 4000L, 1000L)
amount <- c("46.41", "118.11", "84.68", "493.59", "51.10")
test_df <- data.frame(key, amount)
# column names
my_col <- "^am"
# use
test_df %>%
match_cols(my_col)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.