plotOutliers: Find outlying occurrence data

View source: R/plots.R

plotOutliersR Documentation

Find outlying occurrence data

Description

Spatial or environmental outliers

Usage

plotOutliers(
  pres,
  env = NULL,
  outlierNames = c("spOutlier", "envOutlier"),
  shpToPlot = NULL,
  legLoc = "bottomleft"
)

Arguments

pres

a 'SpatialPoints' or 'SpatialPointsDataFrame' object describing the locations of species records. A 'SpatialPointsDataFrame' containing the values of environmental variables to be used must be supplied if 'envOutliers=TRUE'

env

an optional raster object to be plotted

outlierNames

character vector indicating the name of the columns in ‘pres' to plot. e.g., c(’spOutlier','envOutlier')

shpToPlot

an optional spatialPolygons object to be plotted

legLoc

legend location, of the form 'bottomleft', 'topright', etc.

Details

See Examples.

Value

nothing

Author(s)

Cory Merow <cory.merow@gmail.com>

Examples

myPres=read.csv(system.file('extdata/SpeciesCSVs/Camissonia_tanacetifolia.csv',
                            package='occOutliers'))
myPres=myPres[complete.cases(myPres),]
sp::coordinates(myPres)=c(1,2)
myEnv=raster::stack(system.file('extdata/AllEnv.tif',package='occOutliers'))
names(myEnv)=read.table(system.file('extdata/layerNames.csv',package='occOutliers'))[,1]
myPresDF=sp::SpatialPointsDataFrame(myPres,data.frame(raster::extract(myEnv,myPres)))
presOut=findOutlyingPoints(pres=myPresDF,
                           spOutliers=TRUE,
                           envOutliers=TRUE,
                           pval=1e-5)
world.shp=readRDS(system.file('extdata/worldShpMollwide.rds',package='occOutliers'))
plotOutliers(presOut,shpToPlot = world.shp)


cmerow/occOutliers documentation built on July 8, 2023, 8:04 a.m.