Creates a Newick tree from a TreeMan
object.
Usage
writeTree(
tree,
file,
append = FALSE,
ndLabels = function(nd) {
return(NULL)
},
parallel = FALSE,
progress = "none"
)
Details
The ndLabels
argument can be used to add a user defined node label in
the Newick tree. It should take only 1 argument, nd
, the node represented as a list.
It should only return a single character value that can be added to a newick string.
Examples
tree <- randTree(10)
# write out the tree with node labels as IDs
ndLabels <- function(n) {
n[["id"]]
}
writeTree(tree, file = "example.tre", ndLabels = ndLabels)
#> NULL
file.remove("example.tre")
#> [1] TRUE