Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as.Node.phylo

Convert a phylo object from the ape package to a Node


Description

Convert a phylo object from the ape package to a Node

Usage

## S3 method for class 'phylo'
as.Node(
  x,
  heightName = "plotHeight",
  replaceUnderscores = TRUE,
  namesNotUnique = FALSE,
  ...
)

Arguments

x

The phylo object to be converted

heightName

If the phylo contains edge lengths, then they will be converted to a height and stored in a field named according to this parameter (the default is "height")

replaceUnderscores

if TRUE (the default), then underscores in names are replaced with spaces

namesNotUnique

if TRUE, then the name of the Nodes will be prefixed with a unique id. This is useful if the children of a parent have non-unique names.

...

any other parameter to be passed to sub-implementations

See Also

Other ape phylo conversions: GetPhyloNr(), as.phylo.Node()

Examples

#which bird familes have the max height?
library(ape)
data(bird.families)
bf <- as.Node(bird.families)
height <- bf$height
t <- Traverse(bf, filterFun = function(x) x$level == 25)
Get(t, "name")

data.tree

General Purpose Hierarchical Data Structure

v1.0.0
GPL (>= 2)
Authors
Russ Hyde [ctb] (improve dependencies), Chris Hammill [ctb] (improve getting), Facundo Munoz [ctb] (improve list conversion), Markus Wamser [ctb] (fixed some typos), Pierre Formont [ctb] (additional features), Kent Russel [ctb] (documentation), Noam Ross [ctb] (fixes), Duncan Garmonsway [ctb] (fixes), Christoph Glur [aut, cre] (R interface)
Initial release
2020-07-31

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.