(Posted to: r-sig-phylo and GitHub)

Hi all,

is.monophyletic() does not work correctly when some tip labels are duplicated. Here's a simple example:

R> tr <- read.tree(text = "((A,B),(A,C));")

The two tips labelled "A" are not sister-lineages, but the current version of ape gives:

R> is.monophyletic(tr, "A")
[1] TRUE
R> is.monophyletic(tr, c("A", "A")) # <- must interrupt
^C

The reason for this is that the function looks for the first occurrence of "A" in the tip labels of 'tr', even with duplicated labels. By contrast, drop.tip() looks for all occurrences; the following command drops 2 tips even if a single label is given:

R> drop.tip(tr, "A")

Phylogenetic tree with 2 tips and 1 internal nodes.

Tip labels:
  B, C

Rooted; no branch lengths.

The version of ape on GH (will be submitted to CRAN next week) now returns FALSE in both above commands. I assume this change will create no problem for the packages that use this function, but I thought it may be worth explaining this issue ahead of the CRAN submission. As usual, any feedback welcome.

Best,

Emmanuel

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to