R/data_tree.R

Defines functions as_tbl_graph.Node

Documented in as_tbl_graph.Node

#' @describeIn tbl_graph Method to deal with Node objects from the data.tree package
#' @export
as_tbl_graph.Node <- function(x, directed = TRUE, mode = 'out', ...) {
  rlang::check_installed('data.tree', 'in order to coerce Node object to tbl_graph')
  direction <- if (mode == 'out') 'climb' else 'descend'
  as_tbl_graph(data.tree::as.igraph.Node(x, directed = directed, direction = direction, ...))
}

Try the tidygraph package in your browser

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

tidygraph documentation built on June 22, 2024, 11:32 a.m.