impute_nas_mean: Impute missing values with mean

impute_nas_meanR Documentation

Impute missing values with mean

Description

Replace missing values in each variable by the mean of the observed values for that variable.

Usage

impute_nas_mean(dataset)

Arguments

dataset

A dataset object to modify.

Value

A dataset object with the same structure as the input, where missing values in 'dataset$data' have been replaced by the mean of the corresponding variable calculated with 'na.rm = TRUE'.

Examples

data <- matrix(
  c(1, NA, 3, 4),
  nrow = 2,
  dimnames = list(c("x1", "x2"), c("s1", "s2"))
)
dataset <- list(data = data)
impute_nas_mean(dataset)


specmine documentation built on Aug. 5, 2026, 5:06 p.m.