design_missingness_treatment: Design a simple treatment plan to indicate missingingness and...

Description Usage Arguments Value See Also Examples

View source: R/design_missing_Z.R

Description

Design a simple treatment plan to indicate missingingness and perform simple imputation.

Usage

1
2
3
4
5
6
7
8
9
design_missingness_treatment(
  dframe,
  ...,
  varlist = colnames(dframe),
  invalid_mark = "_invalid_",
  drop_constant_columns = FALSE,
  missingness_imputation = NULL,
  imputation_map = NULL
)

Arguments

dframe

data.frame to drive design.

...

not used, forces later arguments to bind by name.

varlist

character, names of columns to process.

invalid_mark

character, name to use for NA levels and novel levels.

drop_constant_columns

logical, if TRUE drop columns that do not vary from the treatment plan.

missingness_imputation

function of signature f(values: numeric), simple missing value imputer.

imputation_map

map from column names to functions of signature f(values: numeric), simple missing value imputers.

Value

simple treatment plan.

See Also

prepare.simple_plan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
d <- wrapr::build_frame(
  "x1", "x2", "x3" |
  1   , 4   , "A"  |
  NA  , 5   , "B"  |
  3   , 6   , NA   )

plan <- design_missingness_treatment(d)
prepare(plan, d)

prepare(plan, data.frame(x1=NA, x2=NA, x3="E"))

vtreat documentation built on June 11, 2021, 5:13 p.m.