na_loess: Replace missing values using local polynomial regression

Description Usage Arguments Examples

View source: R/loess.R

Description

Replace missing values using local polynomial regression

Usage

1

Arguments

data

a data.frame.

formula

an object of class "formula": a symbolic description of the model to be fitted. Alternatively, if formula is a numeric vector, a bivariate model x ~ seq_along(x) is used.

...

further arguments passed to loess.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
na_loess( c(NA, 1, 2, NA, 4, NA, NA, NA, 8))

dat <- mtcars
dat$disp[sample.int(nrow(dat), 10)] <- NA

na_loess(dat, disp ~ mpg + cyl)

set.seed(123)

x <- sin(seq(-4, 4, length.out = 120))
x <- rnorm(120, x, 0.5)
x[sample.int(length(x), 20)] <- NA

plot(x)
points(which(is.na(x)), na_loess(x)[is.na(x)], col = "red", pch = 16)

twolodzko/misster documentation built on May 24, 2019, 2:54 p.m.