knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

knitr::opts_chunk$set(warning=FALSE, message=FALSE, fig.height = 8, fig.width = 8)
library(ComputationalMovementAnalysisData)
library(ggplot2)
library(dplyr)
library(sf)

Temporal Overlap

Since the wildboar were captured sequentially, some of them do not overlap. See ?wildschwein_overlap_temp for more information. Here we visualize these groups so you know how to interpret them.

sampling_periods <- wildschwein_BE %>%
  group_by(TierID, TierName, CollarID) %>%
  summarise(
    min = min(DatetimeUTC),
    max = max(DatetimeUTC)
  )


wildschwein_overlap_temp <- wildschwein_overlap_temp %>%
  left_join(sampling_periods, by = c("TierID", "TierName", "CollarID"))


wildschwein_overlap_temp %>%
mutate(TierCollar = paste(TierName, CollarID)) %>%
  ggplot(aes(xmin = min, xmax = max, y = TierCollar)) +
  geom_errorbarh() +
  facet_grid(Groups~., scales = "free_y", space = "free_y")

Spatial Overlap

wildschwein_sf <- wildschwein_BE %>%
  st_as_sf(coords = c("E", "N"), crs = 2056) %>%
  mutate(tiercollar = paste(TierID, TierName, CollarID)) 


wildschwein_convex_hull <- wildschwein_sf %>%
  group_by(TierID, TierName, CollarID) %>%
  summarise() %>%
  st_convex_hull()


wildschwein_convex_hull %>%
  mutate(tiercollar = paste(TierID, TierName, CollarID)) %>%
  ggplot(aes(fill = factor(TierID))) + geom_sf(alpha = 0.1) +
  coord_sf(datum = 2056) +
  facet_wrap(~tiercollar) +
  theme(legend.position = "none")


st_overlaps(wildschwein_convex_hull, sparse = FALSE)[1:5, 1:5]


ComputationalMovementAnalysis/ComputationalMovementAnalysisData documentation built on Dec. 17, 2021, 3:04 p.m.