intFun.grid.outliers.points: Convert outliers to spatial points

Description Usage Arguments Value Examples

View source: R/intFun.R

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. This function converts outliers to spatial points.

Usage

1
intFun.grid.outliers.points(x, outlier.neg, outlier.pos)

Arguments

x

A raster object

outlier.neg

A number

outlier.pos

A number

Value

A raster object where all outliers are set to NA

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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.points <- intFun.grid.outliers.points(data, threshold.values[1], threshold.values[2])
plot(data); points(outlier.points)

amber documentation built on Aug. 28, 2020, 5:08 p.m.