R/isTip.R

Defines functions isTip.phylo isTip.tbl_tree

Documented in isTip.phylo isTip.tbl_tree

##' @method isTip tbl_tree
##' @rdname isTip
##' @export
isTip.tbl_tree <- function(.data, .node, ...) {
    tips <- .data$node[!.data$node %in% .data$parent]
    return(.node %in% tips)
}

##' @method isTip phylo
##' @rdname isTip
##' @export
isTip.phylo <- function(.data, .node, ...) {
    isTip.tbl_tree(as_tibble(.data), .node, ...)
}

##' @method isTip treedata
##' @rdname isTip
##' @export
isTip.treedata <- isTip.phylo

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.