The function is.binary.tree is obsolete (before being deprecated)


The function is.binary.tree has been introduced in ape 0.2 (September 2002). In ape 4.0 (November 2016), is.binary has been made a generic function with methods for the classes "phylo" (is.binary.phylo) and "multiPhylo" (is.binary.multiPhylo), both being exported in ape's NAMESPACE file.

Why is it important?

This change has made is.binary.tree obsolete. However, several packages use this function, so it is not possible to remove it now.

On the other hand, the class "tree" is defined in the package of the same name. So the function currently in ape may create issues if someone wants to define an is.binary method for the class "tree".

The situation

In March 2019, I found that 25 packages on CRAN use is.binary.tree; this number dropped to 14 in May 2020, and is now 6. The table below lists the occurrences of this function in the code of these packages (in the R/ directory of the sources on CRAN), the file names, and the line numbers.

Package File Line(s)
1 ggrasp ggrasp.cluster.R 266
2 ggrasp ggrasp.create.R 60
3 phyext2 phyext2.R 506
4 phyloTop phyloCheck.R 25,29
5 Rphylip Rphylip.R 2718
6 RRphylo fix.poly.R 86,143
7 RRphylo random.evolvability.test.R 77
8 RRphylo RRphylo.R 50,228,235,244,266,329
9 RRphylo StableTraitsR.R 86,101
10 secsse event_times.R 12

Additionally, the NAMESPACE file of the following packages will eventually need to be adjusted since it includes is.binary.tree in the list of imported functions:


What to do?

In all cases, the simplest thing to do is to replace is.binary.tree by is.binary.phylo.

If you think that your code may be called with trees and/or list of trees (for instance, in a future version), then you may use is.binary.

There is no timeline to implement this change. Once done and you have released a new version of your package on CRAN, you may drop me a message, but that's not an obligation since I have to check all reverse dependencies of ape before submitting a new version to CRAN.

After all packages on CRAN will have implemented this change, is.binary.tree will be changed in the following release of ape to give a warning, so that it will still work in the same way but a new package on CRAN will not be able to use it.

Then, the next following release of ape will have is.binary.tree deprecated (i.e., giving an error with a message pointing to the correct function). Finally, the function might be removed in a future release.
Updated: April 20, 2021
Crédits | Legal notice