categorize: Categorize dataframe columns

Description Usage Arguments Value Examples

View source: R/categorize.R

Description

Denote each dataframe category as numeric, categorical, or text and return a list of lists labeled 'numeric', 'categorical' and 'text' containing column names that fall into each category. A 'categorical' column is any column of type 'factor', or any column with fewer than max_cat unique values. A 'numeric' column is any column of type 'numeric' that is not considered 'categorical' under the specified criteria.

Usage

1
categorize(df, max_cat = 10)

Arguments

df

a data.frame

max_cat

int, the maximum number of unique values that define a categorical column

Value

list with char vectors named 'numeric' and 'categorical', containing column names of each type

Examples

1
categorize(data.frame(a = c(1.2, 2.3, 3.4), b = c('a', 'b', 'c')))

UBC-MDS/laundRy documentation built on March 31, 2020, 12:54 a.m.