Package: phytools 2.3-18

phytools: Phylogenetic Tools for Comparative Biology (and Other Things)

A wide range of methods for phylogenetic analysis - concentrated in phylogenetic comparative biology, but also including numerous techniques for visualizing, analyzing, manipulating, reading or writing, and even inferring phylogenetic trees. Included among the functions in phylogenetic comparative biology are various for ancestral state reconstruction, model-fitting, and simulation of phylogenies and trait data. A broad range of plotting methods for phylogenies and comparative data include (but are not restricted to) methods for mapping trait evolution on trees, for projecting trees into phenotype space or a onto a geographic map, and for visualizing correlated speciation between trees. Lastly, numerous functions are designed for reading, writing, analyzing, inferring, simulating, and manipulating phylogenetic trees and comparative data. For instance, there are functions for computing consensus phylogenies from a set, for simulating phylogenetic trees and data under a range of models, for randomly or non-randomly attaching species or clades to a tree, as well as for a wide range of other manipulations and analyses that phylogenetic biologists might find useful in their research.

Authors:Liam J. Revell

phytools_2.3-18.tar.gz
phytools_2.3-18.zip(r-4.5)phytools_2.3-18.zip(r-4.4)phytools_2.3-18.zip(r-4.3)
phytools_2.3-18.tgz(r-4.4-any)phytools_2.3-18.tgz(r-4.3-any)
phytools_2.3-18.tar.gz(r-4.5-noble)phytools_2.3-18.tar.gz(r-4.4-noble)
phytools_2.3-18.tgz(r-4.4-emscripten)phytools_2.3-18.tgz(r-4.3-emscripten)
phytools.pdf |phytools.html
phytools/json (API)

# Install 'phytools' in R:
install.packages('phytools', repos = c('https://liamrevell.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/liamrevell/phytools/issues

Datasets:

On CRAN:

13.81 score 210 stars 76 packages 4.7k scripts 10k downloads 586 mentions 285 exports 34 dependencies

Last updated 10 days agofrom:24d09d0630. Checks:OK: 5 NOTE: 2. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 24 2024
R-4.5-winNOTEOct 24 2024
R-4.5-linuxNOTEOct 24 2024
R-4.4-winOKOct 24 2024
R-4.4-macOKOct 24 2024
R-4.3-winOKOct 24 2024
R-4.3-macOKOct 24 2024

Exports:add.arrowadd.color.baradd.everywhereadd.randomadd.simmap.legendadd.species.to.genusaic.wallFurcTreesallRotationsanc.Bayesanc.MLanc.trendancrancThreshansi_phyloapplyBranchLengthsarc.cladelabelsas.multiPhyloas.prcompas.princompas.Qmatrixave.ratesaverageTreebackbone.toPhylobdbind.tipbind.tree.simmapbiplot.phyl.pcabmPlotbounded_bmbranching.diffusionbrownie.litebrownieREMLcladelabelscoef.phyl.RMAcollapse.to.starcollapseTreecompare.chronogramscompute.mrconsensus.edgescontMapcophylocospeciationcotangleplotcountSimmapcttdensity.anc.Bayesdensity.multiSimmapdensityMapdensityTreedescribe.simmapdi2multi.simmapdot.legenddotTreedrop.cladedrop.leavesdrop.tip.contMapdrop.tip.densityMapdrop.tip.multiSimmapdrop.tip.simmapdrop.tip.singletonDtestedge.widthMapedgelabels.cophyloedgeProbserrorbar.contMapestDiversityevol.rate.mcmcevol.vcvevolvcv.liteexhaustiveMPexpand.cladeexport.as.xmlextract.clade.simmapextract.strahlerNumberfancyTreefastAncfastBMfastDistfastHeightfastMRCAfindMRCAfit.bdfit.yulefitBayesfitDiversityModelfitfnMkfitgammaMkfitHRMfitMkfitMk.parallelfitmultiBMfitmultiMkfitPagelfitpolyMkfitThreshforce.ultrametricgamma_pruninggammatestgenSeqgenus.to.species.treegeo.legendgeo.paletteget.treeposgetCladesofSizegetDescendantsgetExtantgetExtinctgetnodegetParentgetSistersgetStatesgraph.polyMkgtthide.hiddenkeep.tip.contMapkeep.tip.densityMapkeep.tip.multiSimmapkeep.tip.simmaplabelnodesladderize.simmaplambda.transformlik.bdlikMlambdalikSurface.rateshiftlinklabelslocate.fossillocate.yetils.consensusls.treelttltt.multiPhyloltt.multiSimmapltt.phyloltt.simmapltt95make.era.mapmake.simmapmake.transparentmap.overlapMap.Overlapmap.to.singletonmapped.statesmarkChangesmatchLabelsmatchNodesmccrmcmcMkmergeMappedStatesmidpoint_rootmidpoint.rootminRotateminSplitminTreeDistmodified.Grafenmrp.supertreemulti.mantelmultiCmultiOUmultirateBMmultiRFnode.pathsnodeheightnodeHeightsnodelabels.cophylooptim.phylo.lsorderMappedEdgepaintBranchespaintSubTreepaste.treepbtreepgls.Ivespgls.SEyphenogramphenogram95phyl.ccaphyl.pairedttestphyl.pcaphyl.residphyl.RMAphyl.vcvphylANOVAphylo.heatmapphylo.imputephylo.to.mapphylo.toBackbonephyloDesignphylomorphospacephylomorphospace3dphyloScattergramphylosigplot.anc.Bayesplot.ancrplot.changesMapplot.contMapplot.cophyloplot.densityMapplot.edge.widthMapplot.fitMkplot.fitPagelplot.gfitplot.phyl.RMAplot.phylo.to.mapplot.phylosigplot.Qmatrixplot.simBMphyloplotBranchbyTraitplotFanTree.wTraitsplotSimmapplotThreshplotTreeplotTree.barplotplotTree.boxplotplotTree.datamatrixplotTree.errorbarsplotTree.lollipopplotTree.singletonsplotTree.splitsplotTree.wBarsposterior.evolrateposthocposthoc.ratebytreeprint.Qmatrixproject.phylomorphospacepscoreratebystateratebytreerateshiftread.newickread.simmapreadNexusreorder.backbonePhyloreorderSimmaprep.multiPhylorep.phylorepPhylorerootrerootingMethodrescalerescale.multiSimmaprescale.simmaprescaleSimmapresolveAllNodesresolveNoderootedge.to.singletonrotate.multirotateNodesroundBranchesroundPhylogramrstatesampleFromscoresscores.phyl.pcasetMapsigmoidPhylogramsim.corrssim.cttsim.historysim.Mksim.multiCttsim.multiMksim.ratebystatesim.ratessimBMphylosimmapskewerssplinePhylogramsplitEdgeColorsplitplotTreesplitTreestarTreestrahlerNumberthreshBayesthreshDICthreshStatetiplabels.cophylotipRotateto.matrixtree.growtreeSliceuntanglevcvPhylowrite.simmapwriteAncestorswriteNexus

Dependencies:apecliclusterGenerationcodacodetoolscombinatcpp11DEoptimdigestdoParallelexpmfastmatchforeachgenericsglueigraphiteratorslatticelifecyclemagrittrmapsMASSMatrixmnormtnlmenumDerivoptimParallelphangornpkgconfigquadprogRcpprlangscatterplot3dvctrs

Readme and manuals

Help Manual

Help pageTopics
phytools: Phylogenetic Tools for comparative biology (and other things)phytools-package phytools
Add an arrow pointing to a tip or node on the treeadd.arrow
Add color bar to a plotadd.color.bar
Add tip to all edges in a treeadd.everywhere
Add tips at random to the treeadd.random
Add legend to stochastically mapped treeadd.simmap.legend
Add species to genus on a phylogeny or bind simulated species subtrees to a backbone genus treeadd.species.to.genus genus.to.species.tree
Computes Akaike weightsaic.w
Generate all bi- and multifurcating unrooted treesallFurcTrees
Bayesian ancestral character estimationanc.Bayes density.anc.Bayes plot.anc.Bayes
Ancestral character estimation using likelihoodanc.ML
Ancestral character estimation with a trendanc.trend
Compute marginal or joint ancestral state estimatesancr hide.hidden plot.ancr
Ancestral character estimation under the threshold model using Bayesian MCMCancThresh
Phylogenetic datasetsanole.data anoletree ant.geog ant.tree bat.tree bat_virus.data betaCoV.tree bonyfish.data bonyfish.tree butterfly.data butterfly.tree cordylid.data cordylid.tree darter.tree eel.data eel.tree elapidae.tree flatworm.data flatworm.tree liolaemid.data liolaemid.tree mammal.data mammal.geog mammal.tree primate.data primate.tree salamanders sunfish.data sunfish.tree tortoise.geog tortoise.tree tropidurid.data tropidurid.tree vertebrate.data vertebrate.tree wasp.data wasp.trees whale.tree
Compute the parsimony scoreansi_phylo
Applies the branch lengths of a reference tree to a targetapplyBranchLengths
Conversion to object of class '"multiPhylo"'as.multiPhylo as.multiPhylo.multiSimmap as.multiPhylo.phylo
Convert a fitted M_k_ model to a Q-matrixas.Qmatrix as.Qmatrix.fitMk plot.Qmatrix print.Qmatrix
Average the posterior ratesave.rates
Compute an average tree from a set of trees and related operationsaverageTree ls.consensus minTreeDist
Convert object of class '"birthdeath"' to raw birth & death ratesbd
Attaches a new tip to a treebind.tip
Binds two trees of class '"simmap"'bind.tree.simmap
Simulates and visualizes discrete-time Brownian evolution on a phylogenybmPlot
Fits bounded and wrapped Brownian motion modelsbounded_bm
Animation of branching random diffusionbranching.diffusion
Likelihood test for rate variation in a continuous traitbrownie.lite
REML version of brownie.litebrownieREML
Add labels to subtrees of a plotted phylogenyarc.cladelabels cladelabels
Collapse a subtree to a star phylogenycollapse.to.star
Interactive tree visualizercollapseTree
Compares two chronograms with precisely matching nodes in a visual mannercompare.chronograms
Compute consensus edges for a tree under some criterionconsensus.edges
Map continuous trait evolution on the treecontMap errorbar.contMap plot.contMap
Creates a co-phylogenetic plotcophylo cotangleplot plot.cophylo
Conducts a statistical test of cospeciation between two treescospeciation plot.cospeciation print.cospeciation
Counts the number of character changes on a object of class '"simmap"' or '"multiSimmap"'countSimmap
Generates (or simulates) a 'changes through time' plot from a set of stochastic map character historiesctt sim.ctt sim.multiCtt
Computes a posterior distribution for the number and types of changes on the treedensity.multiSimmap plot.changesMap
Plot posterior density of stochastic mapping on a treedensityMap plot.densityMap
Plots a posterior sample of treesdensityTree make.transparent
Summarizes a stochastic mapped tree or set of treesdescribe.simmap plot.describe.simmap summary.multiSimmap summary.simmap
Collapse or resolve polytomies in a tree with a character painted on the edgesdi2multi.contMap di2multi.densityMap di2multi.multiSimmap di2multi.simmap multi2di.contMap multi2di.densityMap multi2di.multiSimmap multi2di.simmap
Creates a phylogenetic dot plotdot.legend dotTree
Drop a clade from a treedrop.clade
Drop all the leaves (tips) from a treedrop.leaves
Drop tip or tips from an object of class '"contMap"' or '"densityMap"'drop.tip.contMap drop.tip.densityMap keep.tip.contMap keep.tip.densityMap
Drop or keep tip or tips from an object of class '"multiSimmap"'drop.tip.multiSimmap keep.tip.multiSimmap
Drop tips or extract clade from tree with mapped discrete characterdrop.tip.simmap extract.clade.simmap keep.tip.simmap
Conducts correlational D-test from stochastic mappingDtest
Map continuous trait evolution on the treeedge.widthMap plot.edge.widthMap
Compute the relative frequencies of state changes along edgesedgeProbs
Estimate diversity at each node of the treeestDiversity
Bayesian MCMC method for identifying exceptional phenotypic diversification in a phylogenyevol.rate.mcmc plot.summary.evol.rate.mcmc print.evol.rate.mcmc print.summary.evol.rate.mcmc summary.evol.rate.mcmc
Likelihood test for variation in the evolutionary variance-covariance matrixevol.vcv
Likelihood test for a shift in the evolutionary correlation between traitsevolvcv.lite
Exhaustive and branch & bound MP optimizationexhaustiveMP
Expands (or contracts) the tip-spacing of a given clade or cladesexpand.clade plot.expand.clade
Export trees & data in XML formatexport.as.xml
Plots special types of phylogenetic treesfancyTree phenogram95 phyloScattergram
(Reasonably) fast estimation of ML ancestral statesfastAnc
(Reasonably) fast quantitative trait simulation on phylogeniesfastBM
Get the MRCA (or height above the root of the MRCA) of a pair of tip taxafastDist fastHeight fastMRCA
Get the MRCA of a set of taxafindMRCA
Fits birth-death (speciation/extinction) model to reconstructed phylogenyfit.bd fit.yule lik.bd print.fit.bd
Evolutionary model fitting with intraspecific variability using Bayesian MCMCfitBayes
Fit diversity-dependent phenotypic evolution modelfitDiversityModel logLik.fitDiversityModel print.fitDiversityModel
Fits extended M_k_ model for discrete character evolutiondensity.mcmcMk fitfnMk fitgammaMk fitHRM fitMk fitMk.parallel fitmultiMk fitpolyMk graph.polyMk mcmcMk plot.density.mcmcMk plot.fitHRM plot.fitMk plot.fitpolyMk plot.gfit plot.mcmcMk
Fits bounded and wrapped Brownian motion modelsfitmultiBM
Function to test for correlated evolution of binary traitsfitPagel plot.fitPagel
Fits multi-state threshold model using the discrete approximationfitThresh
Coerces a phylogenetic tree to be ultrametricforce.ultrametric
Internally used functiongamma_pruning
Gamma test of Pybus & Harvey (2000)gammatest
Simulate a DNA alignment on the tree under a modelgenSeq
Adds a geological (or other temporal) legend to a plotted treegeo.legend geo.palette
Get position or node of a plotted tree interactivelyget.treepos getnode
Get all subtrees larger than or equal to a specified sizegetCladesofSize
Get descendant node numbersgetDescendants getParent
Returns a list of the extant or extinct lineages in a tree containing non-contemporaneous tipsgetExtant getExtinct
Get the sister node number, label, or set of nodes for a node or tipgetSisters
Get the states at nodes or tips from a mapped treegetStates
Function to interactively label nodes of a plotted treelabelnodes
Ladderize a tree with a mapped discrete characterladderize.simmap
lambda transformation of matrixlambda.transform
Likelihood for joint lambdalikMlambda
Function to add tip labels to a plotted tree with linking lineslinklabels
Locate a fossil lineage in a tree using continuous characterslocate.fossil
Locate a cryptic, recently extinct, or missing taxon on a treelocate.yeti
Least squares branch lengths for a given treels.tree
Creates lineage-through-time plot (including extinct lineages)gtt ltt ltt.multiPhylo ltt.multiSimmap ltt.phylo ltt.simmap mccr
Creates a (1-alpha)% CI for a set of LTTsltt95 plot.ltt95
Create "era" map on a phylogenetic treemake.era.map
Simulate stochastic character maps on a phylogenetic tree or treesmake.simmap simmap
Proportional overlap between two mapped character histories on a treeMap.Overlap map.overlap
Converts a tree without singletons to a tree with singleton nodesdrop.tip.singleton map.to.singleton plotTree.singletons rootedge.to.singleton
Returns a vector, matrix, or list of the mapped states on a tree or set of treesmapped.states
Add marked changes to a plotted tree with mapped discrete charactermarkChanges
Matches nodes between two treesmatchLabels matchNodes
Merge two or more mapped states into one statemergeMappedStates
Midpoint root a phylogenymidpoint.root midpoint_root
Rotates all nodes of the tree to minimize the difference in order with a vectorminRotate tipRotate
Finding the minimum (median) split in the posterior sampleminSplit
Computes modified Grafen edge lengthsmodified.Grafen node.paths
Matrix representation parsimony supertree estimationcompute.mr mrp.supertree
Multiple matrix regression (partial Mantel test)multi.mantel
Returns a list with phylogenetic VCV matrix for each mapped statemultiC
Function to fit a multi-rate Brownian evolution modelmultirateBM
Computes Robinson-Foulds distance between a set of treesmultiRF
Compute the heights above the root of each nodenodeheight nodeHeights
Add labels to a plotted "cophylo" objectedgelabels.cophylo nodelabels.cophylo tiplabels.cophylo
Phylogeny inference using the least squares methodoptim.phylo.ls
Order the columns of mapped.edge to match across treesorderMappedEdge
Paint sub-trees with a discrete characterpaintBranches paintSubTree
Paste two trees togetherpaste.tree
Simulate pure-birth or birth-death stochastic tree or treespbtree
Phylogenetic regression with intraspecific sampling errorpgls.Ives pgls.SEy
Plot traitgram (phenogram)phenogram
Phylogenetic canonical correlation analysisphyl.cca
Phylogenetic paired _t_-testphyl.pairedttest
Phylogenetic principal components analysisas.prcomp as.princomp biplot.phyl.pca phyl.pca scores scores.phyl.pca
Phylogenetic size-correction via GLS regressionphyl.resid
Phylogenetic reduced major axis (RMA) regressioncoef.phyl.RMA phyl.RMA plot.phyl.RMA
Compute evolutionary VCV matrix for a tree & datasetphyl.vcv
Phylogenetic ANOVA and post-hoc testsphylANOVA
Creates a phylogenetic heat mapphylo.heatmap
Phylogenetic imputation for multivariate continuous character dataphylo.impute
Plot tree with tips linked to geographic coordinatesphylo.to.map plot.phylo.to.map
Converts tree to backbone or vice versabackbone.toPhylo phylo.toBackbone
Compute design matrix for least squares analysesphyloDesign
Creates phylomorphospace plotphylomorphospace project.phylomorphospace
Creates three-dimensional phylomorphospace plotphylomorphospace3d
Compute phylogenetic signal with two methodsphylosig plot.phylosig
Plots backbone tree with triangles as cladesplot.backbonePhylo
Plot branch colors by a quantitative trait or valueplotBranchbyTrait
Plot stochastic character mapped treeplot.multiSimmap plot.simmap plotSimmap
Tree plotting with posterior probabilities of ancestral states from the threshold modelplotThresh
Plots rooted phylogenetic treeplotTree
Plot a tree with a discrete (or continuous) character data matrix at the tipsplotFanTree.wTraits plotTree.datamatrix
Plot a tree with error bars around divergence datesplotTree.errorbars
Plot a tree with one or more matched lollipop plotsplotTree.lollipop
Plot a tree with bars at the tipsplotTree.barplot plotTree.boxplot plotTree.wBars
Analysis of the posterior sample from evol.rate.mcmcposterior.evolrate
Generic post-hoc testposthoc
Print method for backbone phylogenyprint.backbonePhylo
Compute the parsimony scorepscore
Method for investigating the rate of one trait as a function of the state of anotherratebystate
Likelihood test for rate variation among trees, clades, or traitsposthoc.ratebytree ratebytree
Find the temporal position of one or more rate shiftslikSurface.rateshift plot.rateshift rateshift
Newick or Nexus style tree readerread.newick readNexus
Read SIMMAP style trees from fileread.simmap
Reorders a backbone phylogenyreorder.backbonePhylo
Reorder edges of a '"simmap"' treereorderSimmap
Replicate a tree or set of treesrep.multiPhylo rep.phylo repPhylo
Re-root a tree along an edgereroot
Get marginal ancestral state reconstructions by re-rootingrerootingMethod
Rescale phylogenetic objects of different typesrescale
Rescale object of class '"simmap"'rescale.multiSimmap rescale.simmap rescaleSimmap
Compute all possible resolutions of a node or all nodes in a multifurcating treeresolveAllNodes resolveNode
Rotates a node or set of nodes in a phylogenetic treeallRotations rotate.multi rotateNodes
Rounds the branch lengths of a treeroundBranches
Plot a round, sigmoidal, or spline phylogram or cladogramroundPhylogram sigmoidPhylogram splinePhylogram
Pick a random state according to a vector of probabilitiesrstate
Sample from a set of distributionssampleFrom
Set color map for various phylogenetic objects of classessetMap setMap.contMap setMap.densityMap setMap.multirateBM_plot setMap.phyloScattergram
Multivariate Brownian simulation with multiple correlations and ratessim.corrs
Simulate character history or a discrete character at the tips of the tree under some modelsim.history sim.Mk sim.multiMk
Conduct simulation of state dependent rate variationsim.ratebystate
Brownian or OU simulation with multiple evolutionary regimesmultiOU sim.rates
Creates a graphical illustration of Brownian motion evolution on a phylogenyplot.simBMphylo simBMphylo
Matrix comparison using the method of random skewersskewers
Split edge colors when descendant edges have different mapped statessplitEdgeColor
Plots a phylogeny in two columnsplotTree.splits splitplotTree
Split tree at a pointsplitTree
Create star phylogenystarTree
Computes Strahler number for trees and nodesextract.strahlerNumber strahlerNumber
Threshold model using Bayesian MCMCthreshBayes
Deviance Information Criterion from the threshold modelthreshDIC
Computes value for a threshold character from a liability and thresholdsthreshState
Convert a character vector to a binary matrixto.matrix
Creates an animation of a tree growing from left-to-right or upwardstree.grow
Slices the tree at a particular point and returns all subtrees, or the tree rootward of the pointtreeSlice
Attempts to untangle crossing branches for plottinguntangle
Calculates cophenetic (i.e., phylogenetic VCV) matrixvcvPhylo
Write a stochastic character mapped tree to filewrite.simmap
Write a tree to file with ancestral states and (optionally) CIs at nodeswriteAncestors
Write a tree to file in Nexus formatwriteNexus