gadget-framework / gadget3

TMB-based gadget implemtation
GNU General Public License v2.0
8 stars 6 forks source link

create param name from multiple name parts #69

Closed willbutler42 closed 1 year ago

willbutler42 commented 1 year ago

Allows multiple name parts to be used for parameter names, e.g., g3_parameterized('K', by_stock = c('species', 'sex'))

lentinj commented 1 year ago

This isn't as simple as this unfortunately, whilst this probably works, straight stock_param(stock, 'K', name_part = c('species', 'sex')) won't. The problem here is conflating a vector with the unparsed code c('species', 'sex'). With a single-length constant it doesn't matter, they're the same thing, but the code to generate a 2-item vector isn't the same as a 2 item vector.

Easy enough to sort though.

lentinj commented 1 year ago

The above fixes that, adding documentation & tests as we go.

willbutler42 commented 1 year ago

Thanks, should the same fix be applied in 'stock_param_table' too?

lentinj commented 1 year ago

Whoops :) Thanks for pointing that out.