valentinitnelav / bootstrapnet

R package for bootstrapping indices of bipartite ecological networks
https://valentinitnelav.github.io/bootstrapnet/
MIT License
5 stars 2 forks source link

Allow user to set the seed #26

Open valentinitnelav opened 4 years ago

valentinitnelav commented 4 years ago

Currently in boot_networklevel the seed is set internally and maybe that is not a good practice. Reproducibility is assured, but maybe should let the user be a bit more in charge of this. In boot_networklevel there are two cases when seed is employed:

  1. In the usage of boot_networklevel_once, when computing a network index for the sampled interactions. Is set internally to set.seed(42);
  2. Then in boot_networklevel_n, when calling sample_indices;
  3. Again in boot_networklevel_n, when running boot_networklevel_once in parallel an the iterator is passed as seed to boot_networklevel_once.

I think point 3 should stay unchanged because each iteration should generate different samples, otherwise we take the same sample every time. Or could generate a sequence of integers of the same length as the amount of iterators based on a user given seed and then pass those as seeds to boot_networklevel_once. However, that sounds unnecessarily complicated...

Nevertheless, the seed at point 2 could be a parameter that the user may want to change. Would this be worth implementing? If yes, then set the default value of 42 so that users don't snap if they test old results with new ones.

This should also be applicable for boot_specieslevel.