impute_missing {AnalysisLin} | R Documentation |
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)
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. |
Value
a data frame with imputed missing values
Examples
data(airquality)
impute_missing(airquality, method='mean')
[Package AnalysisLin version 0.1.2 Index]