identifyMissing: Identify taxa that are not included in phylogeny

View source: R/identifyMissing.R

identifyMissingR Documentation

Identify taxa that are not included in phylogeny

Description

Given a data frame of species and taxonomic assignments, and an accepted phylogeny with some of those species in it, identify which species are not included in the phylogeny.

Usage

identifyMissing(tree, groupings)

Arguments

tree

An ape-style phylogenetic tree

groupings

A data frame with two columns, "species" and "group". Missing species, to be added, are taken as those that do not match a value in the tip labels of tree.

Details

Utility function to identify taxa in the groupings data frame that are not included in the input phylogeny.

Value

A data frame of missing taxa with two columns, species and group.

References

Mast et al. 2015. Paraphyly changes understanding of timing and tempo of diversification in subtribe Hakeinae (Proteaceae), a giant Australian plant radiation. American Journal of Botany.

Examples

data(chelonia)
tree <- chelonia$phy

#some species in this tree are identified to subspecies. drop those
temp <- lapply(strsplit(tree$tip.label, "_"), length)
names(temp) <- tree$tip.label
temp <- temp[temp==2]
tree <- drop.tip(tree, setdiff(tree$tip.label, names(temp)))

#create an example groupings data frame.
groupsDF <- data.frame(species=tree$tip.label)
groupsDF$group <- unlist(lapply(strsplit(tree$tip.label, "_"), "[", 1))

#use the function to drop 100 species (that is over half the species)
example <- tipDropper(tree, groupsDF, 100)

#identify missing species
identifyMissing(example, groupsDF)

eliotmiller/addTaxa documentation built on Feb. 3, 2024, 12:19 a.m.