[R-sig-phylo] A test for valid phylo object (ape package) for package developers

2019-11-05 Thread Elizabeth Purdom
Hello, I am working with the phylo object from the ape package in my own package in which I am manipulating the trees. I would like to check that I have successfully created a valid ape object, but the `checkValidPhylo` function appears to be solely interactive — it prints out a display, and al

Re: [R-sig-phylo] A test for valid phylo object (ape package) for package developers

2019-11-05 Thread Liam Revell
Hi Elizabeth. This does not do exactly what you want, but it is possible to use capture.output() to grab the printout of checkValidPhylo() and then grep() to see if it contains instances of "MODERATE" or "FATAL" errors. The following simple function does that. It returns 0 if neither MODERATE

Re: [R-sig-phylo] A test for valid phylo object (ape package) for package developers

2019-11-05 Thread David Bapst
Hi Elizabeth, There's a lot of ways for trees to be wrong, and surely no tree-checking or tree-fixing function can handle all possibilities. Dating trees and simulating trees can be a messy business, so I used to often hard-crash R with C++ errors all the time until I wrote functions to try to avo

Re: [R-sig-phylo] A test for valid phylo object (ape package) for package developers

2019-11-05 Thread Elizabeth Purdom
Thank you very much, I’ll try that! > On Nov 5, 2019, at 2:20 PM, Liam Revell wrote: > > Hi Elizabeth. > > This does not do exactly what you want, but it is possible to use > capture.output() to grab the printout of checkValidPhylo() and then > grep() to see if it contains instances of "MODER