R/print.R

Defines functions print.proto_graph .print_header

Documented in .print_header print.proto_graph

#' \code{proto_graph} Print Method
#' 
#' @author Christopher Callaghan, \email{cjcallag@@nps.edu}
#' 
#' @param x A class \code{proto_graph} object 
#' @param ... Extra arguments to pass to \code{print()}.
#' @export 
print.proto_graph <- function(x, ...) {
  .print_header(x)
}

#' @keywords internal
#' 
#' @title Print header line for \code{proto_graph} object
#' 
#' @param x A class \code{proto_graph} object 
#' @param ... Extra arguments to pass to \code{print()}.
#' 
#' @importFrom igraph ecount vcount
#' 
.print_header <- function(x, ...) {
  if (!is_proto_graph(x)) {
    stop("Not a proto_graph object.",
         call. = FALSE)
  }
  title <- paste(sep = "",
                 "PROTO_GRAPH ",
                 "\n",
                 " Nodes: ",
                 igraph::vcount(x[["graph"]]),
                 "\n",
                 " Edges: ",
                 igraph::ecount(x[["graph"]]),
                 "\n")
  cat(title)
}
cjcallag/migratr documentation built on Dec. 15, 2019, 9:42 p.m.