writeTree | R Documentation |
Creates a Newick tree from a TreeMan
object.
writeTree(
tree,
file,
append = FALSE,
ndLabels = function(nd) {
return(NULL)
},
parallel = FALSE,
progress = "none"
)
tree |
|
file |
file path |
append |
T/F append tree to already existing file |
ndLabels |
node label function |
parallel |
logical, make parallel? |
progress |
name of the progress bar to use, see |
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.
https://en.wikipedia.org/wiki/Newick_format,
readTree
, randTree
,
readTrmn
, writeTrmn
,
saveTreeMan
, loadTreeMan
tree <- randTree(10)
# write out the tree with node labels as IDs
ndLabels <- function(n) {
n[["id"]]
}
writeTree(tree, file = "example.tre", ndLabels = ndLabels)
file.remove("example.tre")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.