Learn R Programming

radiant.data (version 1.6.3)

to_fct: Convert characters to factors

Description

Convert characters to factors

Usage

to_fct(dataset, safx = 30, nuniq = 100, n = 100)

Arguments

dataset

Data frame

safx

Ratio of number of rows to number of unique values

nuniq

Cutoff for number of unique values

n

Cutoff for small dataset

Details

Convert columns of type character to factors based on a set of rules. By default columns will be converted for small datasets (<= 100 rows) with more rows than unique values. For larger datasets, columns are converted only when the number of unique values is <= 100 and there are 30 or more rows in the data for every unique value

Examples

Run this code
tibble(a = c("a", "b"), b = c("a", "a"), c = 1:2) %>% to_fct()

Run the code above in your browser using DataLab