exportDiagram {PaRe}R Documentation

exportDiagram

Description

Exports the diagram from pkgDiagram to a PDF-file.

Usage

exportDiagram(diagram, fileName)

Arguments

diagram

(grViz)
Graph object from pkgDiagram.

fileName

(character)
Path to save the diagram to, as PDF.

Value

(NULL)

Examples

fetchedRepo <- tryCatch(
  {
    # Set dir to clone repository to.
    tempDir <- tempdir()
    pathToRepo <- file.path(tempDir, "glue")

    # Clone repo
    git2r::clone(
      url = "https://github.com/tidyverse/glue.git",
      local_path = pathToRepo
    )

    # Create instance of Repository object.
    repo <- PaRe::Repository$new(path = pathToRepo)

    # Set fetchedRepo to TRUE if all goes well.
    TRUE
  },
  error = function(e) {
    # Set fetchedRepo to FALSE if an error is encountered.
    FALSE
  },
  warning = function(w) {
    # Set fetchedRepo to FALSE if a warning is encountered.
    FALSE
  }
)

if (fetchedRepo) {
  # Run pkgDiagram on the Repository object.
  pkgDiagram(repo = repo) %>%
    # Export the diagram to a temp file.
    exportDiagram(fileName = tempfile())
}

[Package PaRe version 0.1.13 Index]