pre_impute_df: Impute a data frame

Description Usage Arguments Author(s) Examples

View source: R/imputation.r

Description

This function imputes each column of data frames univariately with different functions depending on their class.

Usage

1
2
3
pre_impute_df(data, class_fun = list(numeric = function(x) median(x, na.rm =
  TRUE), integer = function(x) median(x, na.rm = TRUE)),
  default_fun = function(x) mode(x, na.rm = TRUE, allow_multiple = FALSE))

Arguments

data

Pre-processed data set with features in a data frame.

class_fun

List of functions to use for imputating specific feature classes.

default_fun

Function to use for imputation features of classes not listed in class_fun.

na.rm

Whether to remove missing values.

Author(s)

Christofer Bäcklin

Examples

1
2
3
4
5
6
7
8
x <- iris
x[sample(150, 3), 1] <- NA                                                                          
x[sample(150, 1), 3] <- NA
x[sample(150, 5), 5] <- NA
y <- gl(2, 75)
fold <- resample("holdout", y, nfold=1)[[1]]
data <- pre_split(x, y, fold) %>%
    pre_impute_df

emil documentation built on Aug. 1, 2018, 1:03 a.m.

Related to pre_impute_df in emil...