Description Usage Arguments Value Examples
The data frame is recoded according to a correspondance table containing formulas.
The correpondance table contains a least three fields : condition
, column
and value
.
1 | recode_formula(data, data_recode, new_vars = TRUE)
|
data |
A data frame. |
data_recode |
The correspondance table containing formulas. |
new_vars |
If |
A recoded data frame.
1 2 3 4 5 6 7 8 9 10 11 | # Recode without condition
patchr::recode_formula(
data = dplyr::tibble(test = 1L),
data_recode = dplyr::tibble(condition = NA_character_, column = "test", value = "2L")
)
# Recode with condition
patchr::recode_formula(
data = dplyr::tibble(test = c(1L, 2L)),
data_recode = dplyr::tibble(condition = "test == 2", column = "test", value = "3L")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.