clean_points {Mapinguari}R 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)

[Package Mapinguari version 2.0.1 Index]