impute: Replaces NA values with imputed values

Description Usage Examples

View source: R/impute.R

Description

Given a data.frame and expressions, replaces NaN values. The function is made in the style as dplyr and as such, can use dplyr style operations.

Usage

1
impute(.data, ...)

Examples

1
2
3
4
5
6
7
8
df <- data.frame(
  a = c(1, 2, NA, 20, 30),
  b = seq(1, 5)
)

df %>% impute(a = mean(a, na.rm=TRUE))
df %>% impute(a = mean(b))
df %>% impute(a = sum(b[a > 3], na.rm=T))

Beachnad/dbr documentation built on Nov. 6, 2019, 8:07 p.m.