Update impute.R to 1) clarify impute_gmt_titers parameters and 2) enforce reproducibility#3
Update impute.R to 1) clarify impute_gmt_titers parameters and 2) enforce reproducibility#3TKMarkCheng wants to merge 3 commits intoshwilks:mainfrom
Conversation
Added a random.seed option with a default to assist with reproducibility when set.seed() is not set by the user explicitly during run. random_seed variable is added (with a default of the year 2025) for posterity requirements e.g. monte-carlo simulations.
|
Thanks for these changes, the changes to the documentation look good, thank you for doing that. For the addition of random seeds within functions, typically the method in R packages is simply to use Unless there is a good reason to set the seed within a function this is generally avoided, since it creates some confusion for the user about what the seed is at any given point. If you absolutely do want to change the seed within a function for some reason, it should also be restored again once the function (e.g. Happy to hear if there is a use case where you couldn't simply do the following for reproducibility though set.seed(100)
impute_gmt_titers(...) |
|
Thanks Sam! I've added the within function I agree with your point that it can create some confusion by changing the random seed mid-script and may produce more issues down the line. Agree with keeping it simple. Happy for just the comment amendment to be pulled. |
remove previous commit changes on enforcing a random seed for code simplicity and potential for confusion
update documentation to clarify required
resultforimpute_gmt_titers(result,titer)is fromtitertools::gmt()rather than circular dependency.enforces a random seed variable with a default to help with reproducibility of imputation results for less experienced users