#' @title Node descendant identifier
#'
#' @description Identifies all nodes in a given tree structure
#' which are descendants of the input node.
#'
#' @param x character indicating node
#' @param tree tree structure generated from rcDT()
#' @return Returns all the descendant nodes from the node `x` as a character string
#' @export
de <- function(x, tree)
{
options(stringsAsFactors = FALSE)
if(length(x) != 1) stop("The length of x in function de must be 1.")
y <- tree$node
de <- NA
if(sum(match(x, y), na.rm = T) != 0) {
temp <- 1:length(y)
start <- match(x, y) + 1
end <- length(y)
if(start <= length(y) & nchar(y[start]) > nchar(x)) {
temp1 <- temp[temp >= start & nchar(y) <= nchar(x)][1] - 1
if(!is.na(temp1)) end <- temp1
de <- y[start:end]
}}
de
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.