Skip to contents

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)

Examples


data(mammals)
# let's change the txnym for humans
# what's its summary before we change anything?
summary(mammals[["Homo_sapiens"]])
#> Node (tip node):
#>   + ID: "Homo_sapiens"
#>   + txnym: "Homo"
#>   + prid: "n2938"
#>   + spn: 9.7
#>   + predist: 170
#>   + pd: 0
# now let's add Hominini
new_txnym <- list("Homo_sapiens" = c("Hominini", "Homo"))
mammals <- setTxnyms(mammals, new_txnym)
summary(mammals[["Homo_sapiens"]])
#> Node (tip node):
#>   + ID: "Homo_sapiens"
#>   + txnym: "Hominini", "Homo"
#>   + prid: "n2938"
#>   + spn: 9.7
#>   + predist: 170
#>   + pd: 0