v {labelr}R Documentation

Specify Column Names without Quoting Them

Description

Alternative to the base c() combine operator that allows one to select columns by passing unquoted comma-separated column names instead of quoted, comma-separated column names.

Usage

v(...)

Arguments

...

a vector of unquoted, comma-separated column names.

Details

Does not support or combine with other subsetting operators, such as negative indexing or colon: names must be full, individual column names, separated by commas (see examples).

Value

A character vector of quoted, comma-separated, column names.

Examples

mt2a <- mtcars[c("am", "cyl", "mpg")]
mt2b <- mtcars[v(am, cyl, mpg)]
identical(mt2a, mt2b) # TRUE

# silly demo
mtlabs <- mtcars
mtlabs <- add_val_labs(
  data = mtlabs,
  vars = "am",
  vals = c(0, 1),
  labs = v(a, m) # equivalent to c("a", "m")
)

get_val_labs(mtlabs)

[Package labelr version 0.1.7 Index]