Hi all,

I remember similar questions coming up before, but couldn’t track any down that 
directly pertain to my situation.

Suppose I want to use bplapply() in a function to fit models to many features, 
and I am applying over features. The models are stochastic, and I want the 
results to be reproducible, and preferably use the same RNG seed for each 
feature. So I could do:

fitModels <- function(object, seed=1, BPPARAM=bpparam()) {
bplapply(object, function(x) {
set.seed(seed)
fitModel(x)
}, BPPARAM=BPPARAM)
}

But the BioC guidelines say not to use set.seed() inside function code, and 
I’ve seen other questions answered saying not to use “seed” as a function 
parameter in this way.

Is it preferable to check and modify .Random.seed directly, or is there some 
other standard way of doing this?

Thanks,
Kylie

~~~
Kylie Ariel Bemis
Khoury College of Computer Sciences
Northeastern University
kuwisdelu.github.io<https://kuwisdelu.github.io>









        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to