Re: [R-sig-phylo] A possible alternate MRCA function to APE\'s getMRCA

2017-06-09 Thread Joseph W. Brown
Sweet! I considered preallocation, but figured it was not worth it. Guess I was wrong! JWB Joseph W. Brown Post-doctoral Researcher, Smith Laboratory University of Michigan Department of Ecology & Evolutionary Biology Room 2071, Kraus Natural Sciences

Re: [R-sig-phylo] A possible alternate MRCA function to APE\'s getMRCA

2017-06-09 Thread Klaus Schliep
Hi Joseph I guess I figured out where some room for improvement was. You grow the vector pars <- c(pars, nd) I preallocated pars, but you could even just grow pars using pars[k] <- nd without pre-allocation. This operation is now (with R >= 3.4) far less costly as mentioned in the NEWS:

Re: [R-sig-phylo] A possible alternate MRCA function to APE\'s getMRCA

2017-06-09 Thread Joseph W. Brown
Liam, I put the (updated) code up as a gist . Feel free to use/improve/whatever. Emmanuel sees room for improvement but frankly taking 0.3 seconds to find the MRCA of 5000 taxa on a million-tip tree is good enough for my

Re: [R-sig-phylo] A possible alternate MRCA function to APE\'s getMRCA

2017-06-09 Thread Liam J. Revell
On the other hand, phytools does have a function - the somewhat imprecisely named fastMRCA - which can find the MRCA of just a pair of species much faster than getMRCA (however still slower than or only about as fast as Joseph & Klaus's solutions). Liam J. Revell, Associate Professor of

Re: [R-sig-phylo] A possible alternate MRCA function to APE\'s getMRCA

2017-06-09 Thread Liam J. Revell
Juan. findMRCA was written before getMRCA existed, but the latter was faster so now it just calls getMRCA internally. All the best, Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog:

[R-sig-phylo] A possible alternate MRCA function to APE\'s getMRCA

2017-06-09 Thread Juan Antonio Balbuena
Package phytools includes a function, findMRCA, that is supposed to work very efficiently with large trees. you may wish to compare it with your function. Cheers Juan -- Dr. Juan A. Balbuena