Description Usage Arguments Value Examples
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
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)
|
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. |
Returns the corrected dataframe and a listing of the datatype changes
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.