recode_as_na_if {mde}R Documentation

Conditionally change all column values to NA

Description

Conditionally change all column values to NA

Usage

recode_as_na_if(df, sign = "gteq", percent_na = 50, keep_columns = NULL, ...)

Arguments

df

A data.frame object

sign

Character. One of gteq,lteq,lt,gt or eq which refer to greater than(gt) or equal(eq) or less than(lt) or equal to(eq) respectively.

percent_na

The percentage to use when dropping columns with missing values

keep_columns

Columns that should be kept despite meeting the target percent_na criterion(criteria)

...

Other arguments to "percent_missing"

Value

A 'data.frame' with the target columns populated with 'NA's.

Examples

head(recode_as_na_if(airquality, sign="gt", percent_na=20))

[Package mde version 0.3.2 Index]