Helper function for running over different values of single parameter #173
Replies: 5 comments 3 replies
-
@adamkucharski - Related discussions ongoing in {epidemics} epiverse-trace/epidemics#160 |
Beta Was this translation helpful? Give feedback.
-
Thanks for flagging. Think this is something that will come up both within package functions (e.g. stochastic realisations) and across (e.g. looping over parameters, which many of our packages will use). Not clear to me where the latter would best sit. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure about additional functions here as input/output can vary so much and not sure you gain too much over a lapply or mapply approach (possibly combined with a nested tibble if needed).
I think there is a conversation to be had on functions where you expect individuals to run over multiple inputs and whether there is then a benefit (e.g. ergonomics, efficiency, capturing warnings / errors ) to take vector inputs. |
Beta Was this translation helpful? Give feedback.
-
There will be lots of situations where the input/output will be predictable (i.e. single number input and single number output) – I've probably had this basic use case in most outbreak/epidemic analyses I've worked on. I think the drawback with the above I wouldn't underestimate value of users being able to get a handy output in one easy function rather than a string of ones that require more thought! |
Beta Was this translation helpful? Give feedback.
-
Thanks @adamkucharski for starting this discussion. @TimTaylor, @Bisaloo and I will have a meeting tomorrow at 10:15 GMT to discuss options for an API that works towards this. |
Beta Was this translation helpful? Give feedback.
-
I was recently adapting
finalsize
with some collaborators to explore disease re-emergence from demographic turnover and waning (will write up as vignette when get a minute), and used some of the nice walkthrough in epidemics vignette as starting point.But it make me realise it's still a bit of a pain for users to generate multiple outputs varying over a single parameter and output as neat data.frame (this is something I've spent a lot of time coding up clunky loops for in the past). It feels like a function like the below could be very helpful to streamline examples in tutorials and vignettes. Although it's a wrapper over
Map
andReduce
, I think there's enough non-obvious steps for a moderate R user to justify some simplification in a summary function.The question is where it should sit (e.g. helper function package, or in one dependency-light package like {quickfit} that we then make available to others in vignettes)? Would be interested in thoughts @pratikunterwegs @joshwlambert @Bisaloo.
Beta Was this translation helpful? Give feedback.
All reactions