ezr.factorize: Factorize columns in data

Description Usage Arguments Value Examples

Description

Convert fields in a dataset that are character or contain <= <<factor_le_unique_cnt>> unique values (including NA) If you wish to factor certain fields no matter what and ignore others, use factor_le_unique_cnt = 0. Note that character fields will always factorize no matter what

Usage

1
2
3
ezr.factorize(dataset, specific_fields_must_factor = FALSE,
  make_null_factor = TRUE, factor_le_unique_cnt = 3,
  consider_na_in_count = TRUE)

Arguments

dataset

Dataframe

specific_fields_must_factor

vector of fields that will be converted to factor no matter what

make_null_factor

Use forcats::fct_explicit_na to convert a column to a factor for NA values

factor_le_unique_cnt

default is 3 an includes NA in counting. Checks for number of unique columns in a dataset. If there are <= unique values then converts to a factor

consider_na_in_count

Default TRUE. Should NA be counted towards whether to factorize? For example if values are 0,1, and NA this is 3 unique values if this parameter is set to TRUE.

Value

Returns the corrected dataframe and a listing of the datatype changes

Examples

1

jmp1989/easyr documentation built on May 20, 2019, 7:25 a.m.