Learn R Programming

dataprep (version 0.1.8)

impute_missing: Impute missing values

Description

Impute missing values

Usage

impute_missing(
  data,
  cols = NULL,
  method = "linear",
  group = NULL,
  date_col = NULL,
  max_gap = NULL,
  verbose = FALSE
)

Value

A data frame with imputed values.

Arguments

data

A data frame or matrix.

cols

Columns to impute. If NULL, all numeric columns are used.

method

"linear", "locf", "nocb", "mean", or "median".

group

Optional grouping column.

date_col

Time column.

max_gap

Not implemented; ignored with a warning.

verbose

Logical.

References

1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.

Examples

Run this code
impute_missing(data[1:100, c(1, 4, 17:19)], cols = 3:5, method = "locf")

Run the code above in your browser using DataLab