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

Background

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

I found that 25 packages on CRAN use is.binary.tree() in March 2019, 14 packages in May 2020, 6 packages in April 2021, 5 packages in February 2022, and 4 packages in February 2024.

The table below lists the occurrences of this function in the code of these packages (in the R/ directory of the sources on CRAN).

Package File Line
1 ggrasp ggrasp.create.R 60
ggrasp utils.R 574
2 mmodely phylogeny.R 26
3 phyext2 phyext2.R 506
4 strap DatePhyloHedman.R 219

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:

mmodely
phyext2

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: February 14, 2024
Crédits