dichotomize | R Documentation |
This function is deprecated because partition()
is more general and
can be used to create dummy columns as well.
Create dummy logical columns from selected columns of the data frame. Dummy columns may be created for logical or factor columns as follows:
for logical column col
, a pair of columns is created named col=T
and col=F
where the former (resp. latter) is equal to the original
(resp. negation of the original);
for factor column col
, a new logical column is created for each
level l
of the factor col
and named as col=l
with a value set
to TRUE wherever the original column is equal to l
.
dichotomize(.data, what = everything(), ..., .keep = FALSE, .other = FALSE)
.data |
a data frame to be processed |
what |
a tidyselect expression (see tidyselect syntax) selecting the columns to be processed |
... |
further tidyselect expressions for selecting the columns to be processed |
.keep |
whether to keep the original columns. If FALSE, the original columns are removed from the result. |
.other |
whether to put into result the rest of columns that were not
specified for dichotomization in |
A tibble with selected columns replaced with dummy columns.
Michal Burda
dichotomize(CO2, Plant:Treatment, .other = TRUE)
# ->
partition(CO2, Plant:Treatment)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.