FindVars {wrappedtools}R Documentation

Find numeric index and names of columns based on patterns

Description

[Superseded]

Function ColSeeker extends this by adding class-checks.

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.

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)

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")

[Package wrappedtools version 0.9.5 Index]