knitr::opts_chunk$set(echo = FALSE)
library(drake)
library(dplyr)
library(ggplot2)


## Set up the cache and config
db <- DBI::dbConnect(RSQLite::SQLite(), here::here("analysis", "drake", "drake-cache-bbs-sv.sqlite"))
cache <- storr::storr_dbi("datatable", "keystable", db)

loadd(all_sv, cache = cache)

Maxima

sv_maxima <- all_sv %>%
  group_by(site, singletons) %>%
  summarize(max_s0 = max(s0),
            max_n0 = max(n0),
            ntimesteps = length(unique(timestep))) %>%
  ungroup()

maxima_plot <- ggplot(data = sv_maxima, aes(x = max_s0, y = max_n0, color = ntimesteps)) + 
  geom_point() +
  theme_bw() + 
  xlim(0, max(all_sv$s0) + 5) +
  ylim(0, max(all_sv$n0) + 5) +
  scale_color_viridis_c(end =.9) +
  facet_wrap(vars(singletons))

maxima_plot

The maximum statevars are r max(sv_maxima$max_s0) species and r max(sv_maxima$max_n0) individuals. There are a total of r length(unique(sv_maxima$site)) sites (route-region combinations).

I've made a p-table for these statevars by subsetting the masterp_tall.Rds from diazrenata/scadsanalysis. It'd probably take a day or so to sample from scratch.

Number of timesteps

timesteps_hist <- ggplot(data = filter(sv_maxima, !singletons), aes(x = ntimesteps)) +
  geom_histogram(binwidth = 3) +
  theme_bw()  +
  ggtitle("Timesteps")

timesteps_hist


diazrenata/cats documentation built on Nov. 22, 2019, 7:45 p.m.