Description Usage Arguments Value
Given an input data.frame
and a target column, one-hot encode the
column if the number of unique values is greater than a specified threshold.
The original column is dropped. To prevent whitespace appearing in column
names, any [:space:]
characters are replaced with underscores using
gsub
.
1 | one_hot_encode(df, col, max_n_cats = Inf, drop_one_col = FALSE)
|
df |
A data.frame. |
col |
The column to be encoded. |
max_n_cats |
Columns will only be one-hot encoded if they contain this many categories or fewer. |
A data.frame
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.