stock_age | R Documentation |
Add age dimensions to g3_stock classes
g3s_age(inner_stock, minage, maxage)
g3s_agegroup(inner_stock, agegroups)
inner_stock |
A |
minage |
Minimum age to store, integer. |
maxage |
Maximum age to store, integer. |
agegroups |
(optionally named) list of vectors of ages, grouping them together. |
A g3_stock
with an additional 'age' dimension.
When iterating over the stock, iterate over each age in turn, age will be set to the current integer age.
When intersecting with another stock, only do anything if age is betweem minage and maxage.
If an age dimension already exists, it is redefined with new parameters.
A g3_stock
with an additional 'age' dimension.
When iterating over the stock, iterate over each agegroup in turn, age will be set to the first age in the group.
When intersecting with another stock, only do anything if age is part of one of the groups.
# Define a stock with 3 lengthgroups and 3 ages
stock <- g3_stock('name', c(1, 10, 100)) %>%
g3s_age(5, 10)
# Use stock_instance to see what the array would look like
g3_stock_instance(stock)
# Define a stock that groups age into "young" and "old"
stock <- g3_stock('name', c(1, 10, 100)) %>%
g3s_agegroup(list(
young = 5:7,
old = 8:10))
# Use stock_instance to see what the array would look like
g3_stock_instance(stock)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.