Learn R Programming

wallace (version 2.2.0)

poccs_selectOccs: 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)

Value

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

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.

Author

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

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

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab