R/method-nodeid.R

Defines functions nodelab.treedata nodelab.phylo nodeid.treedata nodeid.phylo

##' @method nodeid phylo
##' @export
nodeid.phylo <- function(tree, label) {
    ## nodeid(as_tibble(tree), label)
    lab <- c(tree$tip.label, tree$node.label)
    match(label, lab)
}

##' @method nodeid treedata
##' @export
nodeid.treedata <- function(tree, label) {
    nodeid(as.phylo(tree), label)
}

##' @method nodelab phylo
##' @export
nodelab.phylo <- function(tree, id) {
    nodelab(as_tibble(tree), id)
}

##' @method nodelab treedata
##' @export
nodelab.treedata <- function(tree, id) {
    nodelab(as.phylo(tree), id)
}

Try the treeio package in your browser

Any scripts or data that you put into this service are public.

treeio documentation built on Nov. 21, 2020, 2:01 a.m.