poccs_selectOccs: poccs_selectOccs Remove occurrences outside of polygon

View source: R/poccs_selectOccs.R

poccs_selectOccsR Documentation

poccs_selectOccs Remove occurrences outside of polygon

Description

This function removes occurrences outside of a user created polygon.

Usage

poccs_selectOccs(occs, polySelXY, polySelID = 1, logger = NULL, spN = NULL)

Arguments

occs

data frame of cleaned occurrences obtained from component occs: Obtain occurrence data.

polySelXY

matrix of longitude and latitude describing the expert drawn polygon.

polySelID

numeric. Polygon ID to be used in SpatialPolygons creation, defaults to 1.

logger

Stores all notification messages to be displayed in the Log Window of Wallace GUI. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL.

spN

data frame of cleaned occurrences obtained from component occs: Obtain occurrence data. Used to obtain species name for logger messages.

Details

This function is called by the select occurrences on map module. It allows for removal of occurrences outside the user drawn polygon in the map. The function will return a data frame of occurrences with all relevant columns for further analyses and without the occurrences outside of the polygon.

Value

A new occurence dataframe including only occurences inside the provided polygon and mantaining all columns from original dataframe for further analyses.

Author(s)

Jamie Kass <jamie.m.kass@gmail.com>

Gonzalo E. Pinilla-Buitrago <gepinillab@gmail.com>

Examples

occs <- read.csv(system.file("extdata/Bassaricyon_neblina.csv",
                             package = "wallace"))[, 2:3]
occs$occID <- 1:nrow(occs)
longitude <- c(-71.58400, -78.81300, -79.34034, -69.83331,
               -66.47149, -66.71319, -71.11931)
latitude <- c(13.18379, 7.52315, 0.93105, -1.70167,
              0.98391, 6.09208, 12.74980)
expertAddedPoly <- matrix(c(longitude, latitude), byrow = FALSE, ncol = 2)
out.occs <- poccs_selectOccs(occs, polySelXY = expertAddedPoly,
                             polySelID = 1)

wallace documentation built on Sept. 11, 2024, 9:16 p.m.