impute_missing: Impute missing values in a specified column of a data frame...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hamr.R

Description

Impute missing values in a specified column of a data frame or a numerical matrix with three simple methods

Usage

1
impute_missing(dfm, col, method, missing_val_char)

Arguments

dfm

A data frame or a numerical matrix

col

A string of column name, if the input data is a matrix, this should be a string like "Vn" where n is an integer representing the index of column

method

A string of a method name, should be one of "CC", "MIP" and "DIP"

missing_val_char

A string of a missing value format, should be one of NA, NaN, "" and "?"

Value

A data frame having no missing values in the specified column

Author(s)

Linsey Yao, March 2018

See Also

na.omit for the complete case

Other aggregate functions: compare_model

Examples

1
2
impute_missing(data.frame(ex = c(1, 2, 3), bf = c(6, 8, "")), "bf", "DIP", "")
impute_missing(matrix(c(1,2,3, 6,8,NA), nrow = 3, ncol = 2, byrow = FALSE), "V2", "DIP", NA)

UBC-MDS/hamr documentation built on May 25, 2019, 1:36 p.m.