View source: R/normalization.R
dummy_data | R Documentation |
Given a matrix or data.frame containing character/factors, this function performs one-hot-encoding.
dummy_data(X, lev = NULL)
X |
A matrix, or a data.frame containing factors. (If the columns are of any other class, they will be coerced into factors anyway). |
lev |
(optional) A vector with the categories ("levels") of each factor. |
X (class: "matrix") after performing one-hot-encoding.
summary(CO2)
CO2_dummy <- dummy_data(CO2[,1:3],lev=dummy_var(CO2[,1:3]))
CO2_dummy[1:10,1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.