standard_column_format: Converts a logical / numeric / character vector or a function...

Description Usage Arguments Examples

Description

If a function is provided, it will be applied to each column of the dataframe and must return a logical; those with resulting value TRUE will be returned as a character vector.

Usage

1
standard_column_format(cols, dataframe)

Arguments

cols

a vector or function. If logical / numeric / character vector, it will attempt to find those columns matching these values. If cols is a function, it will apply this function to each column of the dataframe and return the names of columns for which it was TRUE. Additionally, cols can be a list of any combination of the above, which will require all the conditions to be met.

dataframe

a reference dataframe. Necessary for computing the column names if a numeric or logical vector is specified for cols.

Examples

1
2
3
4
5
standard_column_format(c(1,5), iris)  # c('Sepal.Length', 'Species')
standard_column_format(c(TRUE,FALSE,FALSE,FALSE,TRUE), iris)  # c('Sepal.Length', 'Species')
standard_column_format('Sepal.Length', iris)  # 'Sepal.Length'
standard_column_format(list(is.numeric, c(1,5)), iris)  # 'Sepal.Length'
# TODO: (RK) Explain except()

robertzk/mungebits documentation built on May 27, 2019, 10:35 a.m.