The two functions convert phylogenies in a standard format (newick or phylo) into a form that can be supplied as the argument phydata of phyreg. If node heights are specified, these are also provided in the value returned.
phyfromnewick(file = "", text)
phyfromphylo(phylo)a textfile containing the newick phylogeny, which must end with a semi-colon (phyfromnewick only)
a character variable containing the newick phylogeny, which must end with a semi-colon. Exactly one of these arguments should be supplied (phyfromnewick only)
an R-variable containing a "phylo" object, as used, for example, in the ape package (phyfromphylo only).
The phylogenetic vector in internal format, with an element for every node, except the root, but including species. If jj==phy[[ii], then jj is the parent-node of ii. It is a requirement for the internal format that jj>ii in every case (it is not true of "phylo" objects that a parent's ID has to be greater than its offspring's). Suitable for supplying as the phydata argument of phyreg
The heights of each node, a vector with an element for every node. Thus it is longer by one than $phy. Suitable for supplying as the heightsdata argument of phyreg
The "phylo" style object created by read.newick. (phylofromnewick only)
Before passing the text to read.newick, I strip out all the spaces, to avoid problems.
phyfromnewick contains a function read.newick which "reads Newick style tree with branch lengths into memory as an ape "phylo" object", and was written by Liam J. Revell in 2011, and downloaded on 24th January 2014. See references for url.
Examples are given under phyreg.
https://github.com/liamrevell/phytools/blob/master/R/read.newick.R