Learn R Programming

treeman (version 1.1.4)

setTxnyms: Set the txnym slots in a tree

Description

Return a tree with txnyms added to specified nodes

Usage

setTxnyms(tree, txnyms)

Arguments

tree

TreeMan object

txnyms

named vector or list

Details

Returns a tree. Specify the taxonomic groups for nodes in a tree by providing a vector or list named by node IDs. Takes output from searchTxnyms. Only letters, numbers and underscores allowed. To remove special characters use regular expressions, e.g. gsub(['a-zA-Z0-9_'], '', txnym)

See Also

taxaResolve, searchTxnyms, getNdsLng, getNdLng, https://github.com/DomBennett/treeman/wiki/set-methods

Examples

Run this code
# NOT RUN {
library(treeman)
data(mammals)
# let's change the txnym for humans
# what's its summary before we change anything?
summary(mammals[['Homo_sapiens']])
# now let's add Hominini
new_txnym <- list('Homo_sapiens'=c('Hominini', 'Homo'))
mammals <- setTxnyms(mammals, new_txnym)
summary(mammals[['Homo_sapiens']])
# }

Run the code above in your browser using DataLab