Learn R Programming

emil (version 2.2.3)

pre_impute_df: Impute a data frame

Description

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

Usage

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

Examples

Run this code
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

Run the code above in your browser using DataLab