e1071 (version 1.7-14)

impute: Replace Missing Values

Description

Replaces missing values of a matrix or dataframe with the medians (what="median") or means (what="mean") of the respective columns.

Usage

impute(x, what = c("median", "mean"))

Value

A matrix or dataframe.

Arguments

x

A matrix or dataframe.

what

What to impute.

Author

Friedrich Leisch

Examples

Run this code
x<- matrix(1:10, ncol=2)
x[c(1,3,7)] <- NA
print(x)
print(impute(x))

Run the code above in your browser using DataLab