Description Usage Arguments Details Value Examples
Transforms the original design matrix using a dummy variable encoding.
1 2 3 4 5 6 7 8 | encode_dummy(
X,
fact,
keep_factor = FALSE,
encoding_only = FALSE,
use_reference = TRUE,
reference_value = 0
)
|
X |
The data.frame/data.table to transform. |
fact |
The factor variable to encode by - either a positive integer specifying the column number, or the name of the column. |
keep_factor |
Whether to keep the original factor column(defaults to **FALSE**). |
encoding_only |
Whether to return the full transformed dataset or only the new columns. Defaults to FALSE and returns the full dataset. |
use_reference |
Whether to include a reference level (i.e. whether the new encoding contains an **intercept-like** constant term). Defaults to **TRUE**. |
reference_value |
What the reference value should be if **use_reference** is set to **TRUE**. Defaults to 0. |
The basic dummy variable encoding, with reference class level set to 0. The reference class is always the first class observed.
A new data.table X which contains the new columns and optionally the old factor.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.