Bundle Data for Use in JAGS

make_bundle(
  bbs,
  ebird,
  grid,
  drop.na.cov.obs = TRUE,
  mins.to.hours = TRUE,
  scale.covs = TRUE,
  fill.cov.nas = NA,
  max.ebird = 25,
  use.ebird.in.EN = TRUE,
  EN.arg = "max",
  X = "cell.lon.centroid",
  Y = "cell.lat.centroid",
  cell.id = "gridcellid",
  year.id = "year",
  site.id = c("checklist_id", "rteno"),
  obs.id = c("obsn", "observer_id"),
  cell.covs = c("area"),
  site.covs = c("starttime", "endtime", "wind", "noise", "cars", "minute", "assistant",
    "obsfirstyearbbs", "obsfirstyearonbbs", "obsfirstyearroute", "obsfirstyearonroute",
    "time_observations_started_hsm", "time_observations_started", "duration_minutes",
    "protocol_type", "number_observers"),
  dev.mode = FALSE,
  dir.outputs = "/outputs",
  save.neighborhood = TRUE
)

Arguments

bbs

BBS data table

ebird

eBird data table

grid

spatial sampling grid/study area table

drop.na.cov.obs

logical if TRUE will remove ALL data where any specified covariate does not exist. If TRUE, suggest examining the data and covariates prior to specifying site.covs and grid.covs.

mins.to.hours

logical if TRUE will convert covariates on the minute scale to the hour scale.

scale.covs

logical if TRUE will automatically scale the numeric/integer covariates.

fill.cov.nas

value with with to fill missing covariate values. User can specify value as FALSE if no fill is requested.

max.ebird

integer maximum number of eBird checklists within a single grid cell and year to keep in the data. Does not apply to dev.mode. If an integer is not provided (e.g., NULL, FALSE), all checklists will be returned in the resulting data object.

use.ebird.in.EN

logical if TRUE will use data across both eBird and BBS observations to create basis functions.

EN.arg

if "max" will use the maximum value of observed birds at each grid cell to produce matrix of expected number of birds at the grid cell level. Alternatives include "min", "mean".

X

variable name associated with the x-coordinate (e.g., long, longitude, Easting, X) across 'grid', 'bbs', and 'ebird'

Y

variable name associated with the x-coordinate (e.g., latitude, Northing, Y) across 'grid', 'bbs', and 'ebird'

cell.id

column name(s) of the grid cell identifier

year.id

column name of the temporal identifier

site.id

column name(s) of the site identifier (e.g., BBS route, eBird checklists)

obs.id

column name(s) of the observer identifier

cell.covs

column name(s) of the grid-level covariates

site.covs

column name(s) of the site-level covariates

dev.mode

logical if TRUE will return a reduced data set to use in development/debugging purposes. This method reduces the number of time units to 2, the maximum number of grid cells to 10, and 2 sites from each data source

dir.outputs

directory location of where to save the JAGAM.bugs model file created by mgcv::jagam(). Defaults to ./models/

save.neighborhood

logical if TRUE will save the neighborhood network to file as "neighborhood.rds" at 'dir.outputs'.