HFactory: Header search function factory

View source: R/all.R

HFactoryR Documentation

Header search function factory

Description

Give HFactory an object or a name of an object that has a names attribute (Or a function that *returns* a named object). HFactory will build you an easy-to-use function that encapsulates searching the "header" of the object.

Usage

HFactory(name, ignore.case = TRUE)

Arguments

name

the object or name of the object

ignore.case

do you want your header search function to ignore case?

Value

a function that takes one argument: pattern. Give the return value a name, and you can call it like any other function. It will use grep and pattern to find matching names. The header-search function that is returned will catch name changes, too.

Examples

my_iris <- datasets::iris
hi <- HFactory(my_iris)
hi('length')
hi('width')
my_iris$SpeciesPredicted <- 'TODO'
hi('species')


adamleerich/alrtools documentation built on March 12, 2024, 11:38 p.m.