This function writes a tree to file with ancestral character states and (optionally) 95-percent confidence intervals stored as node value..
writeAncestors(tree, Anc=NULL, file="", digits=6, format=c("phylip","nexus"),
...)a phylogenetic tree or set of trees as an object of class "phylo" or "multiPhylo".
an optional string with the filename for output.
an integer indicating the number of digits to print for branch lengths and ancestral character values.
a string indicating whether to output the result in simple Newick (i.e., "phylip") or Nexus format.
additional arguments including x: a vector of character values, in which case ancestral states are estimated internally using fastAnc; and CI: a logical value indicating whether or not to estimate 95-percent confidence intervals.
A file, string, or vector of strings.
Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.