View source: R/create_recode.R
create_recode | R Documentation |
Creates/standardizes the parameters required for recoding a variable.
create_recode(
old_var,
new_var,
old = NULL,
new = NULL,
new_label = NULL,
simplify_to_numeric = TRUE
)
old_var |
character. Column in the dataset containing the values to be recoded |
new_var |
character. Column where the recoded values will be placed. If |
old |
character (or coercible). value in the column |
new |
character (or coercible). Column indicating where the new values for the recoding process exist. It is positionally (e.g. row) tied to a particular |
new_label |
character (or convertable to character). The factor label that |
simplify_to_numeric |
logical. Converts old and new into numerics if it can be done loselessly. Otherwise, a warning will be thrown. |
This function mostly exists to help translate (via parse_recode_instructions
) data.frame type read-ins of recoding into a standardized form.
These results can then be passed to enact_recoding
as part of a bulk recoding process.
a list of lists (of class recode_instruction).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.