naive_fill_NA: 'naive_fill_NA' function for the simple and automatic...

View source: R/naive_fill_NA.R

naive_fill_NAR Documentation

naive_fill_NA function for the simple and automatic imputation

Description

Automatically fill the missing data with a simple imputation method, impute with sampling the non missing values. It is recommended to use this function for each categorical variable separately.

Usage

naive_fill_NA(x)

## S3 method for class 'data.frame'
naive_fill_NA(x)

## S3 method for class 'data.table'
naive_fill_NA(x)

## S3 method for class 'matrix'
naive_fill_NA(x)

Arguments

x

a numeric matrix or data.frame/data.table (factor/character/numeric/logical variables)

Value

object with a similar structure to the input but without missing values.

Methods (by class)

  • naive_fill_NA(data.frame): S3 method for data.frame

  • naive_fill_NA(data.table): S3 method for data.table

  • naive_fill_NA(matrix): S3 method for matrix

Note

this is a very simple and fast solution but not recommended, for more complex solutions please check the vignette.

See Also

fill_NA fill_NA_N VIF

Examples

## Not run: 
library(miceFast)
data(air_miss)
naive_fill_NA(air_miss)
# Could be useful to run it separately for each group level
do.call(rbind, Map(naive_fill_NA, split(air_miss, air_miss$groups)))

## End(Not run)


miceFast documentation built on Nov. 18, 2022, 1:07 a.m.