simple.impute.data.frame: simple.impute.data.frame

Description Usage Arguments Details Value Author(s) Examples

View source: R/impute.r

Description

Function for imputing a data.frame with missing data.

Usage

1
2
## S3 method for class 'data.frame'
simple.impute(x, fun = stats::median, ...)

Arguments

x

A data.frame

fun

The function with which to fill in missing values

...

Further arguments

Details

Provides the ability to simply impute data based on a simple measure such as mean or median. For more robust imputation see the packages Amelia, mice or mi.

Each column is imputed independently.

Value

A data.frame with the missing values imputed.

Author(s)

Jared P. Lander

Examples

1
2
3
4
5
6
7
theDF <- data.frame(A=1:10, B=1:10, C=1:10)
theDF[c(1, 4, 6), c(1)] <- NA
theDF[c(3, 4, 8), c(3)] <- NA

simple.impute.data.frame(theDF)
simple.impute.data.frame(theDF, mean)
simple.impute.data.frame(theDF, constant(4))

useful documentation built on June 7, 2017, 9:02 a.m.

Search within the useful package
Search all R packages, documentation and source code