removeNA: Replace NA Values with Mean

View source: R/removeNA.R

removeNAR Documentation

Replace NA Values with Mean

Description

Replaces NA values in a numeric vector with the mean of non-NA values. Issues a warning if the proportion of NA values exceeds 5

Usage

removeNA(x)

Arguments

x

A numeric vector containing NA values

Details

The function: * Calculates the proportion of NA values in the input vector * Issues a warning if more than 5 * Replaces all NA values with the mean of non-NA values

Value

A numeric vector with NA values replaced by the mean

Examples

x <- c(1, 2, NA, 4, NA, 6)
removeNA(x)  # Returns c(1, 2, 3.25, 4, 3.25, 6)


ccamp83/mu documentation built on Nov. 7, 2024, 5:17 p.m.