This function cleans coordinates of presence/absence data by removing NA coordinates, rounding coordinates if specified, removing duplicated points, and removing points outside specified spatial polygon boundaries.
clean_coordinates(
df,
study_area,
overlapping = FALSE,
thinning_method = NULL,
thinning_value = NULL,
coords = c("decimalLongitude", "decimalLatitude"),
by_timestamp = TRUE,
seed = NULL
)
A cleaned data frame containing presence/absence data with valid coordinates.
A dataframe object with rows representing points. Coordinates are in WGS84 (EPSG:4326) coordinate system.
A spatial polygon in WGS84 (EPSG:4326) representing the boundaries within which coordinates should be kept.
Logical indicating whether points overlapping the polygon should be removed (TRUE) or kept (FALSE).
Character; spatial thinning method to apply to occurrence data. Options are `c("None", "Distance", "Grid", "Precision")`. See `GeoThinneR` package for details.
Numeric; value used for thinning depending on the selected method: distance in meters (`Distance`), grid resolution in degrees (`Grid`), or decimal precision (`Precision`).
Character vector specifying the column names for longitude and latitude.
If TRUE, clean coordinates taking into account different time periods defined in the column `timestamp`.
Optional; an integer seed for reproducibility of results.
This function takes a data frame containing presence/absence data with longitude and latitude coordinates, a spatial polygon representing boundaries within which to keep points, and parameters for rounding coordinates and handling duplicated points. It returns a cleaned data frame with valid coordinates within the specified boundaries.