dict_recode {mde} | R Documentation |
Recode Missing Values Dictionary-Style
Description
Recode Missing Values Dictionary-Style
Usage
dict_recode(
df,
use_func = "recode_na_as",
pattern_type = "starts_with",
patterns,
values
)
Arguments
df |
A data.frame object for which recoding is to be done. |
use_func |
Function to use for the recoding. One of the various 'recode_*' functions in package 'mde'. |
pattern_type |
One of contains', 'starts_with' or 'ends_with'. |
patterns |
A vector containing patterns to use for pattern_type |
values |
A vector containing values to match to the patterns vector |
Value
A 'data.frame' object with replacements as required.
Examples
head(dict_recode(airquality, pattern_type="starts_with",
patterns = c("Solar", "Ozone"), values = c(190, 41),
use_func="recode_as_na"))
head(dict_recode(airquality, pattern_type="starts_with",
patterns = c("Solar", "Ozone"), values = c(42, 420),
use_func="recode_na_as"))
[Package mde version 0.3.2 Index]