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

View source: R/basefunctions.R

FindVarsR Documentation

Find numeric index and names of columns based on patterns

Description

[Superseded]

Usage

FindVars(
  varnames,
  allnames = colnames(rawdata),
  exact = FALSE,
  exclude = NA,
  casesensitive = TRUE,
  fixed = FALSE,
  return_symbols = 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().

return_symbols

Should names be reported as symbols additionally? (Default FALSE)

Details

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 . Exclusion rules may be specified as well. New function ColSeeker() extends this by adding class-checks.

Value

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

Examples

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. 24, 2023, 5:06 p.m.