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.

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

standard_column_format(c(1,5), iris) # c('Sepal.Length', 'Species')
#> [1] "Sepal.Length" "Species"
standard_column_format(c(TRUE,FALSE,FALSE,FALSE,TRUE), iris) # c('Sepal.Length', 'Species')
#> [1] "Sepal.Length" "Species"
standard_column_format('Sepal.Length', iris) # 'Sepal.Length'
#> [1] "Sepal.Length"
standard_column_format(list(is.numeric, c(1,5)), iris) # 'Sepal.Length'
#> [1] "Sepal.Length"
# TODO: (RK) Explain except()