Re: [R-sig-phylo] branching time to branch length (eg. mcmctree)

2015-10-28 Thread Emmanuel Paradis
Hi Tristan, See compute.brtime in ape. Cheers, Emmanuel Le 28/10/2015 15:31, Tristan Lefebure a écrit : Greetings all, Does anyone know a way to transform branching times into branch length of a chronogram. Like the inverse function of ape::branching.time() ? say you have a chronogram

Re: [R-sig-phylo] branching time to branch length (eg. mcmctree)

2015-10-28 Thread Tristan Lefebure
David, Emmanuel, many thanks! chrono3 <- compute.brtime(tr, bt) all.equal.numeric(chrono$edge.length, chrono3$edge.length) #TRUE all.equal.numeric(chrono$edge.length, as.numeric(chrono2$edge.length)) #also TRUE PS: sorry David, I feel kinda responsible for this lost 16 minutes... On Wed, Oct

Re: [R-sig-phylo] branching time to branch length (eg. mcmctree)

2015-10-28 Thread David Bapst
Tristan, It's alright. To be honest, I am (and should be) quite embarrassed that I overlooked an ape function... I was a nice warm-up exercise, nonetheless, and I can see how to extend it to handle dates for non-ultrametric fossil trees, which is a case not covered by compute.brtimes, and would

Re: [R-sig-phylo] branching time to branch length (eg. mcmctree)

2015-10-28 Thread David Bapst
Hello Tristan, Does the code below work for your purpose? I don't know of a function off the top of my head that does this in a current package on CRAN (and although I might have missed such, I try to keep myself aware of time-scaling functions in R, given my interests). However, its not too