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,
decimal_digits = 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).
An integer specifying the number of decimal places to which coordinates should be rounded.
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.