Learn R Programming

entropart (version 1.1.3)

PhyloApply: Apply a Function over a Phylogenetic Tree

Description

Cuts the tree into slices separated by nodes, applies the function to each slice and returns the weighted (by slice lengths) sum of the results.

Usage

PhyloApply(Tree, FUN, NorP, Normalize = TRUE, ..., CheckArguments = TRUE)

Arguments

Tree
An object of class hclust or phylog or PPtree. The tree must be ultrametric.
FUN
The function to be applied to each interval of the tree.
NorP
A numeric vector or a two-column matrix. Contains either abundances or probabilities. Two-column matrices should contain the observed abundances (or probabilities) in the first column and the expected ones in the second column, to allow using beta diversi
Normalize
If TRUE (default), the Total value returned by Function is normalized by the height of the tree (it is the weighted average value of the result in each slice). If FALSE, it is the unnormalized weighted s
...
Further arguments to pass to Function.
CheckArguments
Logical; if TRUE, the function arguments are verified. Should be set to FALSE to save time when the arguments have been checked elsewhere.

Value

  • An object of class PhyloValue. It is a list:
  • DistributionThe distribution used to calculate the value
  • FunctionThe function used to calculate the value
  • TreeThe functional or phylogenetic tree used to calculate the value
  • NormalizedLogical. Indicates whether phylovalue is normalized or proportional to the height of the tree.
  • CutsA named vector containing values along the tree. Names are cut ends, i.e. the ends of intervals (the first interval starts at 0 for leaves, the max value is the height of the tree).
  • TotalA value equal the total value, multiplied by the tree height if Normalize is FALSE.

Details

This funtion is generally not used directly. It is a tool to calculate PhyloEntropy and PhyloDiversity. Intervals separate two cuts in a tree: no node is found at heights contained in an interval. Objects of class PPtree are returned by Preprocess.Tree.

References

Marcon, E., Herault, B. (2014). Decomposing Phylodiversity. HAL hal-00946177(version 1).

See Also

Preprocess.Tree

Examples

Run this code
# Load Paracou data (number of trees per species in two 1-ha plot of a tropical forest
  #      and their taxonomy)
  data(Paracou618)
  # Plot the taxonomy
  if (require(ade4, quietly = TRUE)) {
    radial.phylog(Paracou618.Taxonomy)
  }
  # Calculate the mean number of trees (individuals) per species 
  # (Cuts are 1=species, 2=genus, 3=family)
  PhyloApply(Paracou618.Taxonomy, mean, Paracou618.MC$Ns, TRUE)

Run the code above in your browser using DataLab