Calculate trip summaries
sum_trips.Rd
sum_trips
quickly calculates summary information
such as maximum distance from the colony, trip start time,
trip end time, and trip duration for each individual trip ID.
The function accepts outputs from either opp_get_trips
or
ctcrw_interpolation
. If interpolated data are provided, the
output provides a summary of interpolated trips.
Examples
my_data <- opp_download_data(study = c(1247096889),login = NULL, start_month = NULL,
end_month = NULL,season = NULL)
#> Warning: 0 location(s) is/are removed by removeDuplicatedTimestamps
my_track2kba <- opp2KBA(data = my_data)
my_trips <- opp_get_trips(data = my_track2kba, innerBuff = 5, returnBuff = 20,
duration = 2, gapLimit = 100, gapTime = 2, gapDist = 2,
showPlots = TRUE)
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Use back arrow in plot pane to browse all plots
my_interp <- ctcrw_interpolation(data = my_trips,
site = my_track2kba$site,
type = c('Complete','Gappy'),
timestep = '10 min',
showPlots = T,
theta = c(8,2),
quiet = TRUE
)
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Beginning SANN initialization ...
#> Beginning likelihood optimization ...
#> Use back arrow in plot pane to browse all plots
sum_trips(my_trips)
#> ID tripID n_locs departure return
#> 1: 1894704341 1894704341_01 310 2019-07-04 13:47:00 2019-07-07 21:46:00
#> 2: 1894704342 1894704342_01 166 2021-07-07 22:03:00 2021-07-08 19:02:00
#> 3: 1894704343 1894704343_01 155 2021-07-09 00:48:00 2021-07-10 05:06:00
#> 4: 1894704345 1894704345_01 539 2019-06-30 22:57:00 2019-07-03 04:49:00
#> 5: 1894704345 1894704345_02 55 2019-07-03 07:33:00 2019-07-03 12:47:00
#> 6: 1894704345 1894704345_03 12 2019-07-03 20:11:00 2019-07-04 00:12:00
#> 7: 1894704351 1894704351_01 465 2019-07-02 02:20:00 2019-07-04 11:49:00
#> 8: 1894704352 1894704352_01 509 2021-07-05 20:49:00 2021-07-09 15:37:00
#> 9: 1894704354 1894704354_01 510 2021-07-06 19:26:00 2021-07-10 04:40:00
#> 10: 1894704355 1894704355_01 52 2019-07-06 07:10:00 2019-07-06 12:48:00
#> 11: 1894704355 1894704355_02 229 2019-07-06 12:58:00 2019-07-07 13:49:00
#> 12: 1894704355 1894704355_03 50 2019-07-07 21:47:00 2019-07-08 12:07:00
#> 13: 1894704356 1894704356_01 425 2021-07-07 12:25:00 2021-07-09 04:58:00
#> 14: 1894704357 1894704357_01 106 2019-07-06 21:22:00 2019-07-07 14:32:00
#> 15: 1894704357 1894704357_02 7 2019-07-08 01:11:00 2019-07-08 10:32:00
#> 16: 1894704357 1894704357_03 3 2019-07-09 06:19:00 2019-07-09 10:58:00
#> 17: 1894704357 1894704357_04 12 2019-07-10 00:23:00 2019-07-10 13:23:00
#> 18: 1894704359 1894704359_01 34 2019-07-08 00:28:00 2019-07-08 03:51:00
#> 19: 1894704359 1894704359_02 155 2019-07-08 04:33:00 2019-07-08 20:34:00
#> 20: 1894704359 1894704359_03 244 2019-07-08 23:22:00 2019-07-10 14:27:00
#> duration max_dist_km complete
#> 1: 79.983333 32.104597 Gappy
#> 2: 20.983333 49.312905 Complete
#> 3: 28.300000 25.103326 Complete
#> 4: 53.866667 65.712186 Complete
#> 5: 5.233333 16.782757 Complete
#> 6: 4.016667 21.775952 Incomplete
#> 7: 57.483333 77.293486 Incomplete
#> 8: 90.800000 63.195759 Gappy
#> 9: 81.233333 97.827162 Gappy
#> 10: 5.633333 9.337911 Complete
#> 11: 24.850000 20.206299 Complete
#> 12: 14.333333 16.745781 Complete
#> 13: 40.550000 43.672393 Complete
#> 14: 17.166667 20.792754 Complete
#> 15: 9.350000 19.575506 Gappy
#> 16: 4.650000 22.856574 Gappy
#> 17: 13.000000 22.945580 Complete
#> 18: 3.383333 14.914383 Complete
#> 19: 16.016667 21.621158 Complete
#> 20: 39.083333 22.758861 Gappy
sum_trips(my_interp)
#> Trip summary provided for interpolated data.
#> ID tripID raw_n_locs interp_n_locs departure
#> 1: 1894704341 1894704341_01 310 480 2019-07-04 13:47:00
#> 2: 1894704342 1894704342_01 166 126 2021-07-07 22:03:00
#> 3: 1894704343 1894704343_01 155 170 2021-07-09 00:48:00
#> 4: 1894704345 1894704345_01 539 324 2019-06-30 22:57:00
#> 5: 1894704345 1894704345_02 55 32 2019-07-03 07:33:00
#> 6: 1894704352 1894704352_01 509 545 2021-07-05 20:49:00
#> 7: 1894704354 1894704354_01 510 488 2021-07-06 19:26:00
#> 8: 1894704355 1894704355_01 52 34 2019-07-06 07:10:00
#> 9: 1894704355 1894704355_02 229 150 2019-07-06 12:58:00
#> 10: 1894704355 1894704355_03 50 87 2019-07-07 21:47:00
#> 11: 1894704356 1894704356_01 425 244 2021-07-07 12:25:00
#> 12: 1894704357 1894704357_01 106 104 2019-07-06 21:22:00
#> 13: 1894704357 1894704357_02 7 57 2019-07-08 01:11:00
#> 14: 1894704357 1894704357_03 3 28 2019-07-09 06:19:00
#> 15: 1894704357 1894704357_04 12 79 2019-07-10 00:23:00
#> 16: 1894704359 1894704359_01 34 21 2019-07-08 00:28:00
#> 17: 1894704359 1894704359_02 155 97 2019-07-08 04:33:00
#> 18: 1894704359 1894704359_03 244 235 2019-07-08 23:22:00
#> return duration max_dist_km complete
#> 1: 2019-07-07 21:37:00 79.833333 32.535738 Gappy
#> 2: 2021-07-08 18:53:00 20.833333 51.948247 Complete
#> 3: 2021-07-10 04:58:00 28.166667 25.103506 Complete
#> 4: 2019-07-03 04:47:00 53.833333 65.695453 Complete
#> 5: 2019-07-03 12:43:00 5.166667 16.831450 Complete
#> 6: 2021-07-09 15:29:00 90.666667 63.216116 Gappy
#> 7: 2021-07-10 04:36:00 81.166667 97.818251 Gappy
#> 8: 2019-07-06 12:40:00 5.500000 9.337153 Complete
#> 9: 2019-07-07 13:48:00 24.833333 20.199154 Complete
#> 10: 2019-07-08 12:07:00 14.333333 16.758592 Complete
#> 11: 2021-07-09 04:55:00 40.500000 43.664284 Complete
#> 12: 2019-07-07 14:32:00 17.166667 20.792636 Complete
#> 13: 2019-07-08 10:31:00 9.333333 19.906181 Gappy
#> 14: 2019-07-09 10:49:00 4.500000 22.856414 Gappy
#> 15: 2019-07-10 13:23:00 13.000000 22.932268 Complete
#> 16: 2019-07-08 03:48:00 3.333333 14.872952 Complete
#> 17: 2019-07-08 20:33:00 16.000000 21.580665 Complete
#> 18: 2019-07-10 14:22:00 39.000000 22.760191 Gappy