View source: R/thin_by_dist_time.R
thin_by_dist_time | R Documentation |
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.
thin_by_dist_time(
data,
dist_min,
interval_min,
coords = NULL,
time_col = "time",
lubridate_fun = c,
dist_method = c("great_circle", "euclidean")
)
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 |
dist_method |
method to compute distance, either "euclidean" or "great_circle". Defaults to "great_circle", which is more accurate but takes slightly longer. |
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.
An object of class sf::sf
or data.frame
, the same as "data".
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.