Learn R Programming

RNeXML (version 2.0.7)

nexml_get: Get the desired element from the nexml object

Description

Get the desired element from the nexml object

Usage

nexml_get(nexml, element = c("trees", "trees_list", "flat_trees", "metadata",
  "otu", "taxa", "characters", "characters_list", "namespaces"), ...)

Arguments

nexml

a nexml object (from read_nexml)

element

the kind of object desired, see details.

...

additional arguments, if applicable to certain elements

Value

return type depends on the element requested. See details.

Details

  • "tree" an ape::phylo tree, if only one tree is represented. Otherwise returns a list of lists of multiphylo trees. To consistently recieve the list of lists format (preserving the heriarchical nature of the nexml), use trees instead.

  • "trees" returns a list of lists of multiphylo trees, even if all trees are in the same `trees` node (and hence the outer list will be of length 1) or if there is only a single tree (and hence the inner list will also be of length 1. This guarentees a consistent return type regardless of the number of trees present in the nexml file, and also preserves any heirarchy/grouping of trees.

  • "flat_trees" a multiPhylo object (list of ape::phylo objects) Note that this method collapses any heirachical structure that may have been present as multiple `trees` nodes in the original nexml (though such a feature is rarely used). To preserve that structure, use `trees` instead.

  • "metadata"Get metadata from the specified level (default is top/nexml level)

  • "otu" returns a named character vector containing all available metadata. names indicate property (or rel in the case of links/resourceMeta), while values indicate the content (or href for links).

  • "taxa" alias for otu

For a slightly cleaner interface, each of these elements is also defined as an S4 method for a nexml object. So in place of `get_item(nexml, "tree")`, one could use `get_tree(nexml)`, and so forth for each element type.

See Also

get_trees

Examples

Run this code
# NOT RUN {
comp_analysis <- system.file("examples", "comp_analysis.xml", package="RNeXML")
nex <- nexml_read(comp_analysis)
nexml_get(nex, "trees")
nexml_get(nex, "characters_list")
# }

Run the code above in your browser using DataLab