Latent positions may be queried using arbitrary date-time values. The only method (for now) is 'linear', but default should be 'geodesic'. In time we include more methods to match the GeoPandas implementation.
track_query(x, y, date = NULL, query, type = "linear")data frame of 'x,y,date' of inferred positions
If date is not included, time itself is treated as the obvious index on n-locations so
simple relative time, and query is expected to match this.
We use group_modify to keep the id groups:
trips0 %>% group_by(id) %>% group_modify(~track_query(.x$x, .x$y, query = c(4.5, 6.7)))
track_query(trips0$x[1:10], trips0$y[1:10], query = c(4.5, 5.5, 6.5))
#> Warning: date is null, so assuming linear relative movement in time
#> x y date
#> 1 116.4852 -42.00301 4.5
#> 2 117.0383 -41.92883 5.5
#> 3 117.3345 -41.84897 6.5
track_query(trips0$x[1:10], trips0$y[1:10], trips0$date[1:10], query = trips0$date[1:10] + 10)
#> x y date
#> 1 115.2776 -42.37477 2001-01-01 15:40:00
#> 2 116.1538 -41.41199 2001-01-01 18:17:02
#> 3 115.9714 -41.13553 2001-01-01 21:03:48
#> 4 116.5145 -42.13828 2001-01-01 22:09:51
#> 5 116.4575 -41.86738 2001-01-01 23:34:04
#> 6 117.6205 -41.99032 2001-01-02 01:25:22
#> 7 117.0488 -41.70678 2001-01-02 06:45:50
#> 8 117.7729 -40.89334 2001-01-02 10:01:36
#> 9 118.1126 -39.74807 2001-01-02 13:50:09
#> 10 NA NA 2001-01-02 16:24:56
s <- seq(min(trips0$date), max(trips0$date), by = "1 hour")