stock_tag | R Documentation |
Add tag dimensions to g3_stock classes
g3s_tag(inner_stock, tag_ids, force_untagged = TRUE)
inner_stock |
A |
tag_ids |
A vector of numeric tags the stock can have, generated by |
force_untagged |
If TRUE, if "untagged" tag 0 isn't present it will be added. |
A g3_stock
with an additional 'tag' dimension.
When iterating over the stock, iterate over each tag in turn, tag will be set to the current integer area.
When interacting with another stock, iterate over each tag in turn, the variable name will depend on the scenario, e.g. prey_tag.
# Make a lookup of text names to integers
tags <- c('H1-00', 'H1-01')
tags <- structure(seq_along(tags), names = tags)
# prey_a can have any of these tags
prey_a <- g3_stock('prey_a', seq(1, 10)) %>% g3s_tag(tags)
# Use stock_instance to see what the array would look like
g3_stock_instance(prey_a)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.