R/sibling.R

Defines functions sibling.phylo

##' @importFrom tidytree sibling
##' @method sibling phylo
##' @export
sibling.phylo <- function(.data, .node, ...) {
    root <- rootnode(.data)
    if (.node == root) {
        return(NA)
    }

    pp <- parent(.data, .node)
    cc <- child(.data, pp)
    sib <- cc[cc != .node]
    return(sib)
}

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.