Simulates survey set locations from a population generated by sim_distribution()
.
Often used prior to running sim_survey()
.
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
)
A simulation object returned by sim_distribution()
.
A logical expression to filter elements of the survey grid.
Can reference columns like x
, y
, depth
, cell
, division
, strat
, or year
(e.g., cell < 100
or year == 3
).
Number of survey simulations to generate.
Numeric vector specifying trawl width and distance (same units as the grid).
Minimum number of sets per stratum.
Set density (number of sets per unit area).
Logical. If TRUE
, allows resampling of grid cells.
Note: allowing resampling may introduce bias, since depletion is applied at the cell level.
A data.table
containing details of each survey set location.
# \donttest{
sim <- sim_abundance(ages = 1:5, years = 1:5) |>
sim_distribution(grid = make_grid(res = c(20, 20)))
# Define different sets for early and later years
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)) # Ensure each 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
# }