fill_na: Fill missing values

Description Usage Arguments Value Examples

View source: R/fill_na.R

Description

Fill missing values

Usage

1
fill_na(data, vals, na_indx = NULL, make_copy = TRUE)

Arguments

data

a data frame with missing values

vals

a named list. Names correspond to columns in data with missing values.

na_indx

a named list containing the indices where missing data are located. Names should correspond to columns in data. The mindx function will create this type of object.

make_copy

a logical value that is only relevant if data is a data.table. if TRUE, a new object is created and data will not be modified. If FALSE, data will be modified in place. The latter will be more efficient but is onyl feasible when you only need to make one imputed data frame.

Value

a data frame with missing values filled in.

Examples

1
2
3
4
5
6
df = data.frame(A = 1:5, B = letters[1:5])
df[1, 1] = NA
df[2, 2] = NA

vals = list(A = 111, B = 'bbb')
fill_na(df, vals)

bcjaeger/ipa documentation built on May 7, 2020, 9:45 a.m.