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 tidytree package in your browser

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

tidytree documentation built on Aug. 10, 2023, 5:07 p.m.