View source: R/select_helpers.R
dt_starts_with | R Documentation |
These functions allow you to select variables based on their names.
dt_starts_with()
: Starts with a prefix
dt_starts_with()
: Ends with a suffix
dt_contains()
: Contains a literal string
dt_everything()
: Matches all variables
dt_starts_with(match)
dt_contains(match)
dt_ends_with(match)
dt_everything()
match |
a character string to match to variable names |
None. To be used within the dt_pivot_*
functions.
library(data.table)
# example of using it with `dt_pivot_longer()`
df <- data.table(row = 1, var = c("x", "y"), a = 1:2, b = 3:4)
pv <- dt_pivot_wider(df,
names_from = var,
values_from = c(dt_starts_with("a"), dt_ends_with("b"))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.