R/plot.rock_graphList.R

Defines functions print.rock_graphList

Documented in print.rock_graphList

#' Plot the graphs in a list of graphs
#'
#' @param x The list of graphs
#' @param ... Any other arguments are passed to [DiagrammeR::render_graph()].
#'
#' @return x, invisibly
#'
#' @method print rock_graphList
#' @export
print.rock_graphList <- function(x, ...) {

  if (is.null(x)) {
    return(invisible(x));
  }

  if (length(x) == 0) {
    return(invisible(x));
  }

  for (i in seq_along(x)) {
    print(
      DiagrammeR::render_graph(
        x[[i]],
        ...
      )
    );
  }

  return(invisible(x));

}

Try the rock package in your browser

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

rock documentation built on Dec. 28, 2022, 1:55 a.m.