Interface to other packages with amt

Johannes Signer

2024-04-01

About

This vignette briefly introduces how one can coerce amt track_xy* to other commonly used packages. At the moment this vignette shows methods to coerce to adehabitatHR, ctmm, and move.

Getting the data ready

First we load the required libraries and the relocation data (called deer)

library(amt)
data("deer")
deer
## # A tibble: 826 × 4
##          x_       y_ t_                  burst_
##  *    <dbl>    <dbl> <dttm>               <dbl>
##  1 4314068. 3445807. 2008-03-30 00:01:47      1
##  2 4314053. 3445768. 2008-03-30 06:00:54      1
##  3 4314105. 3445859. 2008-03-30 12:01:47      1
##  4 4314044. 3445785. 2008-03-30 18:01:24      1
##  5 4313015. 3445858. 2008-03-31 00:01:23      1
##  6 4312860. 3445857. 2008-03-31 06:01:45      1
##  7 4312854. 3445856. 2008-03-31 12:01:11      1
##  8 4312858. 3445858. 2008-03-31 18:01:55      1
##  9 4312745. 3445862. 2008-04-01 00:01:24      1
## 10 4312651. 3446024. 2008-04-01 06:00:54      1
## # ℹ 816 more rows

adehbatit*

adehabitatLT_ltraj <- as_ltraj(deer)
adehabitatLT_ltraj
## 
## *********** List of class ltraj ***********
## 
## Type of the traject: Type II (time recorded)
## * Time zone: UTC *
## Irregular traject. Variable time lag between two locs
## 
## Characteristics of the bursts:
##         id    burst nb.reloc NAs          date.begin            date.end
## 1 animal_1 animal_1      826   0 2008-03-30 00:01:47 2009-04-28 00:00:21
## 
## 
##  infolocs provided. The following variables are available:
## [1] "pkey"

ctmm

With the function as_telemetry a track_xyt can be coerced to a telemetry object used in ctmm.

ctmm_obj <- as_telemetry(deer)
class(ctmm_obj)
## [1] "telemetry"
## attr(,"package")
## [1] "ctmm"

move

Session

sessioninfo::session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.3.2 (2023-10-31)
##  os       macOS Sonoma 14.4
##  system   aarch64, darwin20
##  ui       X11
##  language (EN)
##  collate  C
##  ctype    en_US.UTF-8
##  tz       Europe/Berlin
##  date     2024-04-01
##  pandoc   3.1.11.1 @ /usr/local/bin/ (via rmarkdown)
## 
## ─ Packages ───────────────────────────────────────────────────────────────────
##  package      * version    date (UTC) lib source
##  ade4           1.7-22     2023-02-06 [3] CRAN (R 4.3.0)
##  adehabitatLT   0.3.27     2023-04-06 [3] CRAN (R 4.3.0)
##  adehabitatMA   0.3.16     2023-04-06 [3] CRAN (R 4.3.0)
##  amt          * 0.2.2.0    2024-04-01 [1] local
##  backports      1.4.1      2021-12-13 [3] CRAN (R 4.3.0)
##  boot           1.3-28.1   2022-11-22 [3] CRAN (R 4.3.2)
##  bslib          0.6.1      2023-11-28 [3] CRAN (R 4.3.1)
##  cachem         1.0.8      2023-05-01 [3] CRAN (R 4.3.0)
##  checkmate      2.3.1      2023-12-04 [3] CRAN (R 4.3.1)
##  CircStats      0.2-6      2018-07-01 [3] CRAN (R 4.3.0)
##  circular       0.5-0      2023-09-05 [3] CRAN (R 4.3.0)
##  class          7.3-22     2023-05-03 [3] CRAN (R 4.3.2)
##  classInt       0.4-10     2023-09-05 [3] CRAN (R 4.3.0)
##  cli            3.6.2      2023-12-11 [3] CRAN (R 4.3.1)
##  codetools      0.2-19     2023-02-01 [3] CRAN (R 4.3.2)
##  colorspace     2.1-0      2023-01-23 [3] CRAN (R 4.3.0)
##  ctmm           1.1.0      2022-11-04 [3] CRAN (R 4.3.0)
##  data.table     1.15.2     2024-02-29 [3] CRAN (R 4.3.1)
##  DBI            1.2.2      2024-02-16 [3] CRAN (R 4.3.1)
##  DEoptimR       1.1-3      2023-10-07 [3] CRAN (R 4.3.1)
##  digest         0.6.35     2024-03-11 [3] CRAN (R 4.3.1)
##  dplyr        * 1.1.4      2023-11-17 [3] CRAN (R 4.3.1)
##  e1071          1.7-14     2023-12-06 [3] CRAN (R 4.3.1)
##  evaluate       0.23       2023-11-01 [3] CRAN (R 4.3.1)
##  fansi          1.0.6      2023-12-08 [3] CRAN (R 4.3.1)
##  farver         2.1.1      2022-07-06 [3] CRAN (R 4.3.0)
##  fastmap        1.1.1      2023-02-24 [3] CRAN (R 4.3.0)
##  fitdistrplus   1.1-11     2023-04-25 [3] CRAN (R 4.3.0)
##  generics       0.1.3      2022-07-05 [3] CRAN (R 4.3.0)
##  ggforce        0.4.1      2022-10-04 [3] CRAN (R 4.3.0)
##  ggplot2      * 3.4.4      2023-10-12 [3] CRAN (R 4.3.1)
##  ggraph       * 2.1.0      2022-10-09 [3] CRAN (R 4.3.0)
##  ggrepel        0.9.5      2024-01-10 [3] CRAN (R 4.3.1)
##  glue           1.7.0      2024-01-09 [3] CRAN (R 4.3.1)
##  Gmedian        1.2.7      2022-06-08 [3] CRAN (R 4.3.0)
##  graphlayouts   1.1.0      2024-01-19 [3] CRAN (R 4.3.1)
##  gridExtra      2.3        2017-09-09 [3] CRAN (R 4.3.0)
##  gtable         0.3.4      2023-08-21 [3] CRAN (R 4.3.0)
##  highr          0.10       2022-12-22 [3] CRAN (R 4.3.0)
##  htmltools      0.5.7      2023-11-03 [3] CRAN (R 4.3.1)
##  igraph         2.0.1.1    2024-01-30 [3] CRAN (R 4.3.1)
##  jquerylib      0.1.4      2021-04-26 [3] CRAN (R 4.3.0)
##  jsonlite       1.8.8      2023-12-04 [3] CRAN (R 4.3.1)
##  KernSmooth     2.23-22    2023-07-10 [3] CRAN (R 4.3.2)
##  knitr        * 1.45       2023-10-30 [3] CRAN (R 4.3.1)
##  labeling       0.4.3      2023-08-29 [3] CRAN (R 4.3.0)
##  lattice        0.22-5     2023-10-24 [3] CRAN (R 4.3.1)
##  lifecycle      1.0.4      2023-11-07 [3] CRAN (R 4.3.1)
##  lubridate    * 1.9.3      2023-09-27 [3] CRAN (R 4.3.1)
##  magrittr       2.0.3      2022-03-30 [3] CRAN (R 4.3.0)
##  MASS           7.3-60.0.1 2024-01-13 [3] CRAN (R 4.3.1)
##  Matrix         1.6-5      2024-01-11 [3] CRAN (R 4.3.2)
##  munsell        0.5.0      2018-06-12 [3] CRAN (R 4.3.0)
##  mvtnorm        1.2-4      2023-11-27 [3] CRAN (R 4.3.1)
##  pillar         1.9.0      2023-03-22 [3] CRAN (R 4.3.0)
##  pkgconfig      2.0.3      2019-09-22 [3] CRAN (R 4.3.0)
##  polyclip       1.10-6     2023-09-27 [3] CRAN (R 4.3.1)
##  proxy          0.4-27     2022-06-09 [3] CRAN (R 4.3.0)
##  purrr          1.0.2      2023-08-10 [3] CRAN (R 4.3.0)
##  R6             2.5.1      2021-08-19 [3] CRAN (R 4.3.0)
##  raster         3.6-26     2023-10-14 [3] CRAN (R 4.3.1)
##  rbibutils      2.2.16     2023-10-25 [3] CRAN (R 4.3.1)
##  Rcpp           1.0.12     2024-01-09 [3] CRAN (R 4.3.1)
##  Rdpack         2.6        2023-11-08 [3] CRAN (R 4.3.1)
##  rlang          1.1.3      2024-01-10 [3] CRAN (R 4.3.1)
##  rmarkdown      2.25       2023-09-18 [3] CRAN (R 4.3.1)
##  robustbase     0.99-2     2024-01-27 [3] CRAN (R 4.3.1)
##  RSpectra       0.16-1     2022-04-24 [3] CRAN (R 4.3.0)
##  rstudioapi     0.15.0     2023-07-07 [3] CRAN (R 4.3.0)
##  sass           0.4.8      2023-12-06 [3] CRAN (R 4.3.1)
##  scales         1.3.0      2023-11-28 [3] CRAN (R 4.3.1)
##  sessioninfo    1.2.2      2021-12-06 [3] CRAN (R 4.3.0)
##  sf             1.0-16     2024-03-24 [3] CRAN (R 4.3.1)
##  sp             2.1-3      2024-01-30 [3] CRAN (R 4.3.1)
##  survival       3.5-7      2023-08-14 [3] CRAN (R 4.3.2)
##  terra          1.7-71     2024-01-31 [3] CRAN (R 4.3.1)
##  tibble         3.2.1      2023-03-20 [3] CRAN (R 4.3.0)
##  tidygraph    * 1.3.1      2024-01-30 [3] CRAN (R 4.3.1)
##  tidyr          1.3.1      2024-01-24 [3] CRAN (R 4.3.1)
##  tidyselect     1.2.1      2024-03-11 [3] CRAN (R 4.3.1)
##  timechange     0.3.0      2024-01-18 [3] CRAN (R 4.3.1)
##  tweenr         2.0.2      2022-09-06 [3] CRAN (R 4.3.0)
##  units          0.8-5      2023-11-28 [3] CRAN (R 4.3.1)
##  utf8           1.2.4      2023-10-22 [3] CRAN (R 4.3.1)
##  vctrs          0.6.5      2023-12-01 [3] CRAN (R 4.3.1)
##  viridis        0.6.4      2023-07-22 [3] CRAN (R 4.3.0)
##  viridisLite    0.4.2      2023-05-02 [3] CRAN (R 4.3.0)
##  withr          3.0.0      2024-01-16 [3] CRAN (R 4.3.1)
##  xfun           0.41       2023-11-01 [3] CRAN (R 4.3.1)
##  yaml           2.3.8      2023-12-11 [3] CRAN (R 4.3.1)
## 
##  [1] /private/var/folders/ln/h3zng0fs2pq7mhn_hzn0d8x00000gn/T/Rtmphl5CVm/Rinst6cb5562535ee
##  [2] /private/var/folders/ln/h3zng0fs2pq7mhn_hzn0d8x00000gn/T/RtmpgKr8k0/temp_libpath6a0129d1adcf
##  [3] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
## 
## ──────────────────────────────────────────────────────────────────────────────