# Convert characters to factors

Source: `R/radiant.R`
`to_fct.Rd`

Convert characters to factors

    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

    tibble(a = c("a", "b"), b = c("a", "a"), c = 1:2) %>% to_fct()
    #> # A tibble: 2 × 3
    #>   a     b         c
    #>   <chr> <fct> <int>
    #> 1 a     a         1
    #> 2 b     a         2