Description Usage Arguments Value Details Examples
Find stops made in a route given coordinates and timestamps from a GPS track.
1 2 | find_stops(.data, stop_min_duration_s = 10, digits = 3, k = 3,
.vars = c(time = "datetime", lat = "latitude", lon = "longitude"))
|
.data |
(data.frame) GPS dataset. |
stop_min_duration_s |
(integer) Minimum stop duration cutoff in seconds. (Must be greater than k. Default: 10) |
digits |
(integer) Decimal places used for rounding. (Must be 0 or greater. Default: 3) |
k |
(integer) Window length for rolling median. (Must be odd, 3 or greater. Default: 3) |
.vars |
(named character vector) The datetime, latitude, and longitude
variables to be found within |
(tibble) The coordinates and timestamps of the identified stops, along with the stop durations (integer), will be returned as a tibble.
Stops are determined by finding sequential observations near the same location.
A rounded rolling median is used for latitude and longitude with rle()
to reduce noise. For this purpose, rounding is to digits
decimal places.
The stop duration cutoff stop_min_duration_s
is in seconds, assuming
one observation per second. Otherwise, consider this as the minimum number of
observations per stop.
The GPS dataset can be a data.frame, tibble, data.table, etc., or any other object of class data.frame or that inherits from class data.drame. It must include the variables named in ".vars" which are "datetime" (datetime), "latitude" (numeric), and "longitude" (numeric) by default. If the variables are present within ".data", they will be converted to the expected data types before stop detection is performed.
1 2 3 4 5 6 | ## Not run:
library(readr)
df <- read_csv(system.file("extdata", "test_data.csv", package = "stopr"))
find_stops(df)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.