[Bioc-devel] Use set.seed inside function

Meng Chen mengchen18 @end|ng |rom gm@||@com
Mon Nov 29 21:21:05 CET 2021


Dear BioC team and developers,

I am using BiocCheck to check my package, it returns a warning:
" Remove set.seed usage in R code"

I am using "set.seed" inside my functions, before calling function
distinctColorPalette (randomcoloR package) in order to generate
reproducible "random distinct colors". So what would be the best practice
to solve this warning? I think
1. use set.seed and don't change anything.
2. use the set.seed function, but include something like below inside the
function
*gl.seed <- .Random.seed*
*on.exit(assign(".Random.seed", gl.seed, envir = .GlobalEnv))*
3. use some other functions for the purpose

Any suggestions will be appreciated. Thanks.
-- 
Best Regards,
Chen

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list