Get the dependency interactions as a graph representation.

getGraphData(repo, packageTypes = c("Imports"))

Arguments

repo

(Repository)
Repository object.

packageTypes

(c: c("Imports")) of (character) Any of the following options may be included in a vector:

  • "imports"

  • "depends"

  • "suggests"

  • "enhances"

  • "linkingto"

Value

(as_tbl_graph)

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
  }
)
#> cloning into 'C:\Users\MVANKE~1\AppData\Local\Temp\RtmpwNkTBX/glue'...

if (fetchedRepo) {
  # Run getGraphData on the Repository object.
  if (interactive()) {
    getGraphData(repo = repo, packageTypes = c("Imports"))
  }
}