outlier2na: Remove statistical outliers from time-series values

Description Usage Arguments Value Author(s) See Also Examples

View source: R/outlier2na.R

Description

This is a wrapper function around tsOutliers that automatically removes identified statistical outliers from a measurement series.

Usage

1
outlier2na(val, lower_quantile = 0.2, upper_quantile = 0.8, ...)

Arguments

val

Numeric. A vector of observed time-series values.

lower_quantile

Numeric, default is 0.2. The lower quantile limit.

upper_quantile

Numeric, default is 0.8. The upper quantile limit.

...

Additional arguments passed to tsOutliers.

Value

An outlier-cleaned numeric vector of time-series values.

Author(s)

Florian Detsch

See Also

tsOutliers

Examples

1
2
3
4
5
6
7
8
9
# Random time-series values
set.seed(10)
x <- rnorm(100, 0, 2)

# Replace outliers with NA
x2 <- outlier2na(x, lower_quantile = .35, upper_quantile = .7)

plot(x, type = "l", lty = 2)
lines(x2, col = "red")

environmentalinformatics-marburg/GSODTools documentation built on May 13, 2017, 6:09 p.m.