Thanks, Emmanuel. I was not familiar with .Random.seed objects until R CHECK started complaining about such elements in saved workspaces within .rdata files within packages (requiring rm to remove them), and then was mainly familiar with them regarding set.seed() (and so I thought ace must be setting a seed, not just initializing one). It makes sense that any random number generation would incur a seed, and apparently fresh R sessions do not immediately initialize a seed.
Thanks to everyone who helped me see my confusion! Just me missing a basic comp sci concept. -Dave On Fri, Oct 20, 2017 at 4:26 AM, Emmanuel Paradis <emmanuel.para...@ird.fr> wrote: > Hi Dave, > > The seed is created every time you generate random data (see details in > ?.Random.seed): > > R> exists(".Random.seed") > [1] FALSE > 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") > [1] FALSE > R> o <- ace(x, bird.orders) > R> exists(".Random.seed") > [1] FALSE > > 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") > [1] FALSE > 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, ...). > > Best, > > Emmanuel > > > 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: >> >> library(ape) >> tree<-rtree(10) >> ace(1:10,tree) >> .Random.seed >> >> 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? >> >> Cheers, >> -Dave >> > -- David W. Bapst, PhD Postdoc, Ecology & Evolutionary Biology, Univ of Tenn Knoxville Lecturer, Geology & Geophysics, Texas A & M University https://github.com/dwbapst/paleotree Google Calender: https://goo.gl/EpiM4J _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/