Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

intFun.grid.outliers.na

Set all values outside a range to NA


Description

Plotting raster objects that contain extreme outliers lead to plots where most grid cells are presented by a single color since the color legend covers the entire range of values. To avoid this, the user may define upper and lower threshold values, which can then be set to NA and marked as outliers.

Usage

intFun.grid.outliers.na(x, outlier.neg, outlier.pos)

Arguments

x

A raster object

outlier.neg

A number that presents the lower bound of the interquartile range

outlier.pos

A number that presents the upper bound of the interquartile range

Value

A raster object where all outliers are set to NA

Examples

library(raster)
# create a raster object with outliers
data <- c(runif(98,-10,10), -1000, 1000)
data <- matrix(data, ncol=10)
data <- raster::raster(data)
# compute upper and lower threshold values for outliers
threshold.values <- intFun.grid.define.outlier(data, 2)
# Set all values outside the outlier range to NA
outlier.neg <- threshold.values[1]
outlier.pos <- threshold.values[2]
data.no.outliers <- intFun.grid.outliers.na(data, outlier.neg, outlier.pos)
plot(data.no.outliers)

amber

Automated Model Benchmarking R Package

v1.0.3
GPL-3
Authors
Christian Seiler [cre, aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.