Simulate survey sets

sim_sets(
  sim,
  subset_cells,
  n_sims = 1,
  trawl_dim = c(1.5, 0.02),
  min_sets = 2,
  set_den = 2/1000,
  resample_cells = FALSE
)

Arguments

sim

Simulation object from sim_distribution

subset_cells

Logical expression indicating the elements (x, y, depth, cell, division, strat, year) of the survey grid to keep (e.g., cell < 100)

n_sims

Number of simulations to produce

trawl_dim

Trawl width and distance (same units as grid)

min_sets

Minimum number of sets per strat

set_den

Set density (number of sets per grid unit squared)

resample_cells

Allow resampling of sampling units (grid cells)? (Note: allowing resampling may create bias because depletion is imposed at the cell level)

Value

Returns a data.table including details of each set location.

Examples


# \donttest{
sim <- sim_abundance(ages = 1:5, years = 1:5) %>%
          sim_distribution(grid = make_grid(res = c(20, 20)))

## Multiple calls can be useful for defining a custom series of sets
standard_sets <- sim_sets(sim, year <= 2, set_den = 2 / 1000)
reduced_sets <- sim_sets(sim, year > 2 & !cell %in% 1:100, set_den = 1 / 1000)
sets <- rbind(standard_sets, reduced_sets)
sets$set <- seq(nrow(sets)) # Important - make sure set has a unique ID.

survey <- sim_survey(sim, custom_sets = sets)

plot_survey(survey, which_year = 3, which_sim = 1)
#> No trace type specified:
#>   Based on info supplied, a 'scatter' trace seems appropriate.
#>   Read more about this trace type -> https://plotly.com/r/reference/#scatter
# }