File: data_tree.R

package info (click to toggle)
r-cran-tidygraph 1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 880 kB
  • sloc: cpp: 41; sh: 13; makefile: 2
file content (7 lines) | stat: -rw-r--r-- 405 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
#' @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, ...))
}