impute: Replace Missing Values

View source: R/impute.R

imputeR Documentation

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"))

Arguments

x

A matrix or dataframe.

what

What to impute.

Value

A matrix or dataframe.

Author(s)

Friedrich Leisch

Examples

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

e1071 documentation built on Dec. 7, 2023, 8:15 p.m.