Learn R Programming

RNeXML (version 2.0.7)

get_characters: Get character data.frame from nexml

Description

Get character data.frame from nexml

Usage

get_characters(nex, rownames_as_col = FALSE, otu_id = FALSE,
  otus_id = FALSE)

Arguments

nex

a nexml object

rownames_as_col

option to return character matrix rownames (with taxon ids) as it's own column in the data.frame. Default is FALSE for compatibility with geiger and similar packages.

otu_id

logical, default FALSE. return a column with the otu id (for joining with otu metadata, etc)

otus_id

logical, default FALSE. return a column with the otus block id (for joining with otu metadata, etc)

Value

the character matrix as a data.frame

Details

RNeXML will attempt to return the matrix using the NeXML taxon (otu) labels to name the rows and the NeXML char labels to name the traits (columns). If these are unavailable or not unique, the NeXML id values for the otus or traits will be used instead.

Examples

Run this code
# NOT RUN {
# A simple example with a discrete and a continous trait
f <- system.file("examples", "comp_analysis.xml", package="RNeXML")
nex <- read.nexml(f)
get_characters(nex)

# A more complex example -- currently ignores sequence-type characters
f <- system.file("examples", "characters.xml", package="RNeXML")
nex <- read.nexml(f)
get_characters(nex)
# }

Run the code above in your browser using DataLab