Learn R Programming

tidysynthesis (version 0.1.2)

expand_na: Add new variables that indicate if a value is "missing" or "not missing" for original variables that contain NA

Description

Add new variables that indicate if a value is "missing" or "not missing" for original variables that contain NA

Usage

expand_na(
  data,
  types = c("chr", "dbl", "fct", "lgl", "int", "ord"),
  skip_vars = NULL
)

Value

An augmented data frame with the original variables and new variables that contain the missingness patterns of variables with NA

Arguments

data

A data frame

types

A vector of variables types to expand

skip_vars

A character vector of variables that shouldn't be expanded

Examples

Run this code

expand_na(data = example_na, type = c("dbl", "int"))

Run the code above in your browser using DataLab