Hi Dave,

The seed is created every time you generate random data (see details in ?.Random.seed):

R> exists(".Random.seed")
R> sample(1)
[1] 1
R> exists(".Random.seed")
[1] TRUE

So in your code below the seed is created by calling rtree(). Indeed, with ape 4.1:

R> rm(".Random.seed")
R> data(bird.orders)
R> x <- 1:23
R> exists(".Random.seed")
R> o <- ace(x, bird.orders)
R> exists(".Random.seed")

However, with the new "soon-to-be-on-CRAN" version, a seed is created by the same code. The "culprit" is actually Rcpp: the new ape has C++ code linked to Rcpp. For a reason I ignore, it seems that a random seed is initialized when calling a function linked to Rcpp. Here is an example:

R> rm(".Random.seed")
R> library(RcppEigen)
R> exists(".Random.seed")
R> o <- fastLm(1, 1)
R> exists(".Random.seed")
[1] TRUE

The new C++ code in ape is called by reorder(phy, "postorder") which is used by many functions in ape (ace, pic, plot.phylo, vcv, ...).



Le 19/10/2017 à 21:00, David Bapst a écrit :
Emmanuel, all-

I noticed today that a workspace I was working with had a random
number seed set in it, but didn't remember setting one. Finally, I
discovered the culprit was ace. Here's a reproducible example,
demonstrating that a seed exists after running ace:


I am using ape 4.1, and it doesn't seem to be addressed in the
forthcoming version, given my reading of the changes log (but I might
have missed it). What's going? Why is a random number seed being set?


R-sig-phylo mailing list - R-sig-phylo@r-project.org
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to