# A parameter template, would already be got via. attr(g3_to_tmb(...), "parameter_template")
pt <- data.frame(
switch = c(
paste0('fish.init.', 1:9),
paste0('fish.rec.', 1990:2000),
'fish.M'),
value = NA,
lower = NA,
upper = NA,
parscale = NA,
optimise = FALSE,
random = FALSE)
# Set all fish.init.# parameters to optimise
pt <- g3_init_val(pt, 'fish.init.#', 4, spread = 8)
# Set a fixed value for any .M
pt <- g3_init_val(pt, '*.M', value = 0.3, optimise = FALSE)
# Set a fixed value for a range of recruitment years, optimise the rest
pt |>
g3_init_val('*.rec.#', value = 4, lower = 0, upper = 10) |>
g3_init_val('*.rec.[1993-1996]', value = 0, optimise = FALSE) |>
identity() -> pt
pt
Run the code above in your browser using DataLab