[Bioc-devel] Use set.seed inside function
James W. MacDonald
jm@cdon @end|ng |rom uw@edu
Mon Nov 29 21:38:55 CET 2021
It appears that you don't actually want random colors, but instead you want the same colors each time. Why not just generate the vector of 'random distinct colors' one time and save the vector of colors?
-----Original Message-----
From: Bioc-devel <bioc-devel-bounces using r-project.org> On Behalf Of Meng Chen
Sent: Monday, November 29, 2021 3:21 PM
To: bioc-devel using r-project.org
Subject: [Bioc-devel] Use set.seed inside function
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]]
_______________________________________________
Bioc-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel
More information about the Bioc-devel
mailing list