View source: R/defactor_refactor.R
defactor | R Documentation |
Convert a factor (or an object that can be converted as such) into an vector of integers indexed from 0 (instead of 1 as usual in R). This is what xgboost expects as input for classification tasks.
defactor(x)
x |
vector of class factor (or character). |
A vector of integers encoding factors, starting at 0.
defactor(factor(c("a", "b", "a")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.