library(magrittr)
tags <- c('H1-00', 'H1-01')
tags <- structure(seq_along(tags), names = tags)
prey_a <- g3_stock('prey_a', seq(1, 10)) %>% g3s_tag(tags)
fleet_a <- g3_fleet('fleet_a')
actions <- list(
# NB: If g3_tag() is used in the stock, initialconditions/renewal
# will only renew into tag == 0 (i.e. untagged)
g3a_predate_tagrelease(
# Setup as-per g3a_predate_fleet
fleet_a,
list(prey_a),
suitabilities = list(prey_a = 1),
catchability_f = g3a_predate_catchability_numberfleet(~100),
# Optional tag mortality suitability
mortality_f = g3_suitability_straightline(
g3_parameterized('mort_alpha'),
g3_parameterized('mort_beta')),
# Formula to decide which tag to output into, generate table
# with one tag per year
output_tag_f = g3_timeareadata('fleet_a_tags', data.frame(
year = 2000:2001,
tag = tags[c('H1-00', 'H1-01')],
stringsAsFactors = FALSE), value_field = "tag"),
# Experiment only happens in spring
run_f = ~cur_step == 2),
g3a_tag_shedding(
list(prey_a),
# i.e. 0.125 will loose their tag each step
tagshed_f = log(8)))
Run the code above in your browser using DataLab