knitr::opts_chunk$set(echo = TRUE)

install aniMotum dev branch

remotes::install_github("ianjonsen/aniMotum@dev")
require(tidyverse, quietly = TRUE)
require(aniMotum, quietly = TRUE) 
jc <- readRDS("Jcrab35.rds")
names(jc) <- tolower(names(jc))

d <- jc %>%
  select(id = transmitter,
         date = datetime,
         x,
         y,
         sd.x = sdx,
         sd.y = sdy) %>%
  mutate(date = mdy_hm(date, tz = "America/New_York")) %>%
  tibble()

#df <- format_data(d, coord = c("lon","lat"), sderr = c("sd.x","sd.y"))
df <- format_data(d, coord = c("x","y"), sderr = c("sd.x","sd.y"))

Fit crw SSM with 5 min time.step

fit <- fit_ssm(df, model = "crw", time.step = 5/60, 
               control = ssm_control(verbose = 0))

Visualize fit as 1-D time series

plot(fit, "p")

Visualize fit as 2-D track

plot(fit, "p", type=2, alpha = 0.01)


ianjonsen/foieGras documentation built on Jan. 17, 2025, 11:15 p.m.