dt_starts_with: Select helpers

Description Usage Arguments Value Examples

View source: R/select_helpers.R

Description

These functions allow you to select variables based on their names.

Usage

1
2
3
4
5
6
7

Arguments

match

a character string to match to variable names

Value

None. To be used within the dt_pivot_* functions.

Examples

1
2
3
4
5
6
7
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")))

tidyfast documentation built on March 20, 2020, 5:08 p.m.