to_missind: Recode a target column in dataframe to indicator of...

View source: R/to_missind.R

to_missindR Documentation

Recode a target column in dataframe to indicator of missingness

Description

Returns the input dataframe with the target column recoded such that 0 = missing and 1 = present.

To facilitate a common task that would otherwise require a pattern like this:

df %>% mutate(x = ifelse( ! is.na(x), 1, 0)) %>% count(x)

Usage

to_missind(data, x)

Arguments

data

Dataframe

x

String indicating name of target column

Details

Note that despite the name "missingness indicator", a value of 1 = present.

Examples

to_missind(mice::boys, "bmi")

wepelham3/sack2 documentation built on Aug. 5, 2023, 5:53 a.m.