FindVars: Find numeric index and names of columns based on patterns

Description Usage Arguments Value Examples

View source: R/basefunctions.R

Description

FindVars looks up colnames (by default for data-frame rawdata) based on parts of names, using regular expressions. Be warned that special characters as e.g. [ ( need to be escaped or replaced by . Exlusion rules may be specified as well.

Usage

1
2
3
4
5
6
7
8
FindVars(
  varnames,
  allnames = NULL,
  exact = FALSE,
  exclude = NA,
  casesensitive = TRUE,
  fixed = FALSE
)

Arguments

varnames

Vector of pattern to look for.

allnames

Vector of values to detect pattern in; by default, colnames(rawdata).

exact

Partial matching or exact only (adding ^ and $)?

exclude

Vector of pattern to exclude from found names.

casesensitive

Logical if case is respected in matching (default FALSE: a<>A)

fixed

Logical, match as is, argument is passed to grep().

Value

A list with index, names, backticked names, and symbols

Examples

1
2
3
4
FindVars(varnames = c("^c", "g"), allnames = colnames(mtcars))
FindVars(varnames = c("^c", "g"), allnames = colnames(mtcars), exclude = "r")
rawdata <- mtcars
FindVars(varnames = c("^c", "g"))

wrappedtools documentation built on Sept. 6, 2021, 5:08 p.m.