Description Usage Arguments Details Value Author(s) See Also Examples
These functions compare taxa present in phylogenies with community or trait data sets, pruning and sorting the two kinds of data to match one another for subsequent analysis.
1 2 3 | match.phylo.comm(phy, comm)
match.phylo.data(phy, data)
match.comm.dist(comm, dis)
|
phy |
A phylogeny object of class phylo |
comm |
Community data matrix |
data |
A data object - a vector (with names matching phy) or a data.frame or matrix (with row names matching phy) |
dis |
A distance matrix - a dist or matrix object |
A common pitfall in comparative analyses in R is that taxa labels are assumed to match between phylogenetic and other data sets. These functions prune a phylogeny and community or trait data set to match one another, reporting taxa that are missing from one data set or the other.
Taxa names for phylogeny objects are taken from the phylogeny's tip labels. Taxa names for community data are taken from the column names. Taxa names for trait data are taken from the element names (vector) or row names (data.frame or matrix). Taxa names for distance data are taken from column/row names of the distance matrix/dist object.
If community data lack taxa names, the function will issue a warning and no result will be returned, since the community-phylogenetic analyses in picante
require named taxa in the community data set.
If trait data or distance matrix lack names, a warning is issued and the data are assumed to be sorted in the same order as the phylogeny's tip labels or community's column labels.
These utility functions are used by several functions that assume taxa labels in phylogeny and data match, including Kcalc
, phylosignal
, and raoD
.
A list containing the following elements, pruned and sorted to match one another:
phy |
A phylogeny object of class phylo |
comm |
Community data matrix |
data |
A data object (vector, data.frame or matrix) |
dist |
A distance matrix - a dist or matrix object |
Steven Kembel <steve.kembel@gmail.com>
1 2 3 | data(phylocom)
match.phylo.comm(phylocom$phylo, phylocom$sample)
match.phylo.data(phylocom$phylo, phylocom$traits[1:10,])
|
Loading required package: ape
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-3
Loading required package: nlme
[1] "Dropping tips from the tree because they are not present in the community data:"
[1] "sp16" "sp23" "sp27" "sp28" "sp30" "sp31" "sp32"
$phy
Phylogenetic tree with 25 tips and 24 internal nodes.
Tip labels:
sp1, sp2, sp3, sp4, sp5, sp6, ...
Node labels:
A, B, C, D, E, F, ...
Rooted; includes branch lengths.
$comm
sp1 sp2 sp3 sp4 sp5 sp6 sp7 sp8 sp9 sp10 sp11 sp12 sp13 sp14 sp15 sp17
clump1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
clump2a 1 1 1 1 0 0 0 0 2 2 2 2 0 0 0 0
clump2b 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 2
clump4 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 2
even 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 1
random 0 1 0 0 2 0 0 0 0 0 0 1 0 4 2 3
sp18 sp19 sp20 sp21 sp22 sp24 sp25 sp26 sp29
clump1 0 0 0 0 0 0 0 0 0
clump2a 0 0 0 0 0 0 0 0 0
clump2b 2 2 2 0 0 0 0 0 0
clump4 2 0 0 0 0 0 2 2 0
even 0 0 0 1 0 0 1 0 1
random 0 0 0 0 1 2 0 0 0
[1] "Dropping tips from the tree because they are not present in the data:"
[1] "sp11" "sp12" "sp13" "sp14" "sp15" "sp16" "sp17" "sp18" "sp19" "sp20"
[11] "sp21" "sp22" "sp23" "sp24" "sp25" "sp26" "sp27" "sp28" "sp29" "sp30"
[21] "sp31" "sp32"
$phy
Phylogenetic tree with 10 tips and 9 internal nodes.
Tip labels:
sp1, sp2, sp3, sp4, sp5, sp6, ...
Node labels:
B, C, D, E, F, G, ...
Rooted; includes branch lengths.
$data
traitA traitB traitC traitD
sp1 1 1 1 0
sp2 1 1 2 0
sp3 2 1 3 0
sp4 2 1 4 0
sp5 2 2 1 0
sp6 2 2 2 0
sp7 2 2 3 0
sp8 2 2 4 0
sp9 1 3 1 1
sp10 1 3 2 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.