clean_points: Clean occurrence records

View source: R/clean_points.R

clean_pointsR Documentation

Clean occurrence records

Description

clean_points Eliminates species occurrence records that are too close to each other or at undesired locations.

Usage

clean_points(
  coord,
  merge_dist,
  coord_col = c("Lon", "Lat"),
  filter_layer = NULL,
  na.rm = FALSE
)

Arguments

coord

data.frame. Data frame containing longitudes (Lon) and latitudes (Lat) of occurrence records of a species.

merge_dist

numeric. Maximum distance between points to be merged, in meters.

coord_col

vector of strings or integers. If x has more than two columns, indicate the name or position of longitude and latitude columns

filter_layer

RasterLayer. Binary raster with 1 representing the regions where records should be kept and 0 the regions where they should be eliminated.

na.rm

logical. if TRUE, remove lines with NA in any coordinate.

Value

Data frame with remaining longitudes and latitudes.

Examples

## Not run: 
#First, we need to obtain an altitude raster to filter by altitude.
library(raster)
alt <- raster::getData("alt", country = "BRA", mask = TRUE)

# Then, we clean the points
 TtorquatusDistribution_clean <-
  clean_points(coord = TtorquatusDistribution,
               merge_dist = 20000,
               filter_layer = !is.na(alt))

## End(Not run)

gabrielhoc/Mapinguari documentation built on July 6, 2023, 6:40 p.m.