outlier2na: Remove statistical outliers from time-series values

View source: R/outlier2na.R

outlier2naR Documentation

Remove statistical outliers from time-series values

Description

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

Usage

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

# 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 Jan. 5, 2024, 12:19 a.m.