Description Usage Arguments Value Examples
Apply explicit dummy coding to a data frame
1 |
data |
A data frame to be passed in (e.g., via piping) |
factor |
A name of a factor column. Can be quoted or unquoted |
reference |
A string of the level that should be coded as the reference level. Defaults to the first level of the factor if one is not provided. |
A data.frame
. A tibble passed into data
is returned as a tibble.
1 2 3 4 5 6 7 | # column name can be quoted or unquoted
col_dummy(iris, "Species", reference = "virginica")
col_dummy(iris, Species, reference = "virginica")
# model interpretation is the same
lm(Sepal.Length ~ Species, data = iris)
lm(Sepal.Length ~ Speciesversicolor + Speciesvirginica, data = col_dummy(iris, Species))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.