createAccessor: Create Function to Safely Access Data Frame Columns or List...

View source: R/createAccessor.R

createAccessorR Documentation

Create Function to Safely Access Data Frame Columns or List Elements

Description

Create Function to Safely Access Data Frame Columns or List Elements

Usage

createAccessor(x)

Arguments

x

a data frame or a list

Examples

getcol <- createAccessor(data.frame(a = 1:2, b = 2:3))
getcol("a")
getcol("b")
getcol(c("b", "a"))
# getcol("c") # error with info about existing columns


KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.