Learn R Programming

naniar (version 0.6.0)

impute_mean: Impute the mean value into a vector with missing values

Description

Impute the mean value into a vector with missing values

Usage

impute_mean(x)

# S3 method for default impute_mean(x)

# S3 method for factor impute_mean(x)

Arguments

x

vector

Value

vector with mean values replaced

Examples

Run this code
# NOT RUN {
vec <- rnorm(10)

vec[sample(1:10, 3)] <- NA

impute_mean(vec)

# }

Run the code above in your browser using DataLab