thin_by_dist_time {tidysdm} | R Documentation |
Thin points dataset based on geographic and temporal distance
Description
This function thins a dataset so that only observations that have a distance from each other greater than "dist_min" in space and "interval_min" in time are retained.
Usage
thin_by_dist_time(
data,
dist_min,
interval_min,
coords = NULL,
time_col = "time",
lubridate_fun = c
)
Arguments
data |
An |
dist_min |
Minimum distance between points (in units appropriate for the projection, or meters for lonlat data). |
interval_min |
Minimum time interval between points, in days. |
coords |
A vector of length two giving the names of the "x" and "y"
coordinates, as found in |
time_col |
The name of the column with time; if time is not a lubridate object,
use |
lubridate_fun |
function to convert the time column into a lubridate object |
Details
Geographic distances are measured in the appropriate units for the projection used. In case
of raw latitude and longitude (e.g. as provided in a data.frame), the crs is set
to WGS84, and units are set to meters. Time interval are estimated in days. Note that for
very long time period, the simple conversion x years = 365 * x days might lead
to slightly shorter intervals than expected, as it ignores leap years. The function
y2d()
provides a closer approximation.
This function an algorithm analogous to spThin
, with the exception that
neighbours are defined in terms of both space and time.
Value
An object of class sf::sf
or data.frame
, the same as "data".