Learn R Programming

AnalysisLin (version 0.1.2)

impute_missing: Missing Value Imputation

Description

This function performs missing value imputation in the input data using various methods. The available imputation methods are:

- "mean": Imputes missing values with the mean of the variable. - "median": Imputes missing values with the median of the variable. - "mode": Imputes missing values with the mode of the variable (for categorical data). - "locf": Imputes missing values using the Last Observation Carried Forward method. - "knn": Imputes missing values using the k-Nearest Neighbors algorithm (specify k).

Usage

impute_missing(data, method = "mean", k = NULL)

Value

a data frame with imputed missing values

Arguments

data

Input data.

method

Method of handling missing values: "mean," "median," "mode," "locf," or "knn."

k

Value of the number of neighbors to be checked (only for knn method). Default is NULL.

Examples

Run this code
data(airquality)
impute_missing(airquality, method='mean')

Run the code above in your browser using DataLab