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.
categorize(df, max_cat = 10)
df | a data.frame |
---|---|
max_cat | int, the maximum number of unique values that define a categorical column |
list with char vectors named 'numeric' and 'categorical', containing column names of each type
#> $numeric #> character(0) #> #> $categorical #> [1] "b" "a" #>