get_char_matrix: Obtains a character-state matrix from a nexml object

View source: R/nexml.R

get_char_matrixR Documentation

Obtains a character-state matrix from a nexml object

Description

Obtains a character-state matrix from a nexml object

Usage

get_char_matrix(nex, otus_id = TRUE, states_as_labels = FALSE, verbose = FALSE)

Arguments

nex

a nexml object

otus_id

logical, default TRUE, return a column with the otus block id.

states_as_labels

logical, default FALSE, when TRUE returns states as labels instead of symbols. One can also use state_symbols2labels() to translate symbols to labels later.

verbose

logical, default FALSE, If TRUE, messages informing about steps is printed.

Value

data.frame: The character-state matrix. The first column (taxa) contains taxon ids. The second column (otu) contains otu ids. When the otus_id parameter is TRUE the third column (otus) will contain otu block ids. The remaining columns are named for each anatomical label in the dataset and contain the associated state values.

See Also

get_char_matrix_meta() to retrieve metadata for a nexml object.

Examples

# applied to a (synthetic) Ontotrace matrix:
nex <- get_ontotrace_data(taxon = c("Ictalurus", "Ameiurus"), entity = "fin spine")
get_char_matrix(nex, otus_id = FALSE)

# applied to a data matrix for a study
slist <- get_studies(taxon = "Ictalurus australis", entity = "fin spine")
nex <- get_study_data(slist$id[1])[[1]]
# for brevity show only 6 character data columns and first 5 rows
get_char_matrix(nex, otus_id = FALSE)[1:5,1:8]
# same, but states as labels (this can take a while)
get_char_matrix(nex, otus_id = FALSE, states_as_labels = TRUE)


xu-hong/rphenoscape documentation built on Jan. 28, 2024, 12:22 p.m.