Detailed description |
Currently prune(phylo4d) calls prune(phylo4) twice: once to prune the user-supplied tree, and another time to prune a fully labeled tree in order to reconstruct which tips/nodes were pruned. This was necessary when prune was just a wrapper for ape::drop.tip, but doesn't seem necessary now that the code is all in phylobase.
A better approach might be to make prune(phylo4) a wrapper for prune(phylo4d), rather than the reverse. In other words, prune(phylo4d) would contain all the code that's currently in prune(phylo4), plus also deal with the data (if it exists). The prune(phylo4) method can then be reduced a simple wrapper for prune(phylo4d) that does something like (1) coerce tree to phylo4d, (2) call prune, and (3) apply extractTree to get result. |
|