powered by
Create rule based on mappings
rule( ..., .lst = list(...), .string_as_fct = TRUE, .na_last = TRUE, .drop = FALSE, .to_NA = "" )
a rule object.
rule
Mapping pairs, the argument name is the transformed while its values are original values.
(list) of mapping.
list
(flag) whether to convert characters to factors.
flag
(flag) whether the level replacing NA should be last.
NA
(flag) whether to drop empty levels.
(character) values that should be converted to NA. Set to NULL if nothing should be converted to NA.
character
NULL
rule("X" = "x", "Y" = c("y", "z")) rule("X" = "x", "Y" = c("y", "z"), .drop = TRUE, .to_NA = c("a", "b"), .na_last = FALSE)
Run the code above in your browser using DataLab