Learn R Programming

mde (version 0.3.2)

dict_recode: 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

Run this code
# NOT RUN {
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"))
# }

Run the code above in your browser using DataLab