naniar (version 0.4.2)

recode_shadow: Add special missing values to the shadow matrix

Description

It can be useful to add special missing values, naniar supports this with the recode_shadow function.

Usage

recode_shadow(data, ...)

Arguments

data

data.frame

...

A sequence of two-sided formulas as in dplyr::case_when, but when a wrapper function .where written around it.

Value

a dataframe with altered shadows

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
df <- tibble::tribble(
~wind, ~temp,
-99,    45,
68,    NA,
72,    25
)

dfs <- bind_shadow(df)

dfs

recode_shadow(dfs, temp = .where(wind == -99 ~ "bananas"))

# need to debug this

recode_shadow(dfs,
              temp = .where(wind == -99 ~ "bananas")) %>%
recode_shadow(wind = .where(wind == -99 ~ "apples"))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab