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 avoid this. (At one point, now many years ago, and probably not true anymore, but if you had a tree with nodes ordered in a way opposite of what ape expected, you could cause your operating system to blue-screen if you tried to plot the tree...). `paleotree::testEdgeMat` tests the edge matrix, which is often the source of problems, for inconsistencies. There is also paleotree function `cleanNewPhylo` will try to clean a tree of any of the stuff or misordered nodes that can cause a hard crash, particularly by reading it out as a text string and reading it back in with write.tree and read.tree.
I hope this helps, -Dave On Tue, Nov 5, 2019 at 2:54 PM Elizabeth Purdom <epur...@stat.berkeley.edu> wrote: > > 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 always > returns NULL. > > Is there a function in the ape package (or can there be?) that would do the > checks, but return the results in a way that I can then process in my > function? (e.g. return a vector of each of the checks as TRUE/FALSE) And I > don’t want anything printed out, since I don’t want that output to be printed > for users of my function). > > I see the package `paleotree` has ported some of those checks into a test, so > I’m guessing such a function doesn’t exist in ape — and I don’t really want a > dependency on another package just for these checks. > > Thanks, > Elizabeth Purdom > _______________________________________________ > R-sig-phylo mailing list - Rfirstname.lastname@example.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://email@example.com/ -- David W. Bapst, PhD Assistant Instructional Professor Geology & Geophysics Texas A & M University https://github.com/dwbapst/paleotree _______________________________________________ R-sig-phylo mailing list - Rfirstname.lastname@example.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://email@example.com/