ColSeeker: Find numeric index and names of columns based on type and...

View source: R/basefunctions.R

ColSeekerR Documentation

Find numeric index and names of columns based on type and patterns

Description

ColSeeker looks up colnames (by default for tibble rawdata) based on type and 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.

Usage

ColSeeker(
  data = rawdata,
  namepattern = ".",
  varclass = NULL,
  exclude = NULL,
  excludeclass = NULL,
  casesensitive = TRUE,
  returnclass = FALSE
)

Arguments

data

tibble or data.frame, where columns are to be found; by default rawdata

namepattern

Vector of pattern to look for.

varclass

Vector, only columns of defined class(es) are returned

exclude

Vector of pattern to exclude from found names.

excludeclass

Vector, exclude columns of specified class(es)

casesensitive

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

returnclass

Logical if classes should be included in output

Value

A list with index, names, and backticked names, optionally the classes as well

Examples

ColSeeker(data = mtcars, namepattern = c("^c", "g"))
ColSeeker(data = mtcars, namepattern = c("^c", "g"), exclude = "r")
rawdata <- mtcars
ColSeeker(namepattern = c("^c", "g"), varclass="numeric")

wrappedtools documentation built on Sept. 24, 2023, 5:06 p.m.