Function to detect suspicious outliers based on environmental variables.
Source:R/suspicious_env_outliers.R
suspicious_env_outliers.Rd
Run outlier.tree
to detect suspicious outliers in observations.
Usage
suspicious_env_outliers(
occ,
occ_crs = 4326,
variables,
rm_outliers = FALSE,
seed = 10L,
...,
visualize = TRUE
)
Arguments
- occ
(
data.frame
,sf
,SpatialPointsDataFrame
) The occurrence dataset for training. There must be columnx
andy
for coordinates if it is a regulardata.frame
.- occ_crs
(
numeric
orcrs
) The EPSG number orcrs
object of occurrence CRS. The default value is4326
, which is the geographic coordinate system.- variables
(
RasterStack
orstars
) The stack of environmental variables.- rm_outliers
(
logical
) The option to remove the suspicious outliers or not. The default isFALSE
.- seed
(
integer
) The random seed used in the modeling. It should be an integer. The default is10L
.- ...
Other arguments passed to function
outlier.tree
in packageoutliertree
.- visualize
(
logical
) IfTRUE
, plot the result. The default isTRUE
.
Value
(EnvironmentalOutlier
) A list that contains
outlier_details (
tibble
) A table of outlier details returned from functionoutlier.tree
in packageoutliertree
pts_occ (
sf
) Thesf
points of occurrence. Ifrm_outliers
isTRUE
, outliers are deleted from points of occurrence. IfFALSE
, the full observations are returned.
Details
Please check more details in R documentation of function
outlier.tree
in package outliertree
and their GitHub.
See also
print.EnvironmentalOutlier
, plot.EnvironmentalOutlier
outlier.tree
in package outliertree
Examples
library(dplyr)
library(sf)
library(stars)
library(itsdm)
data("occ_virtual_species")
env_vars <- system.file(
'extdata/bioclim_tanzania_10min.tif',
package = 'itsdm') %>% read_stars() %>%
slice('band', c(1, 5, 12))
occ_outliers <- suspicious_env_outliers(
occ = occ_virtual_species, variables = env_vars,
z_outlier = 3.5, outliers_print = 4L, nthreads = 1)
occ_outliers
plot(occ_outliers)