Type: Package
Title: Statically Determine Function Dependencies Between Packages
Version: 1.1.1
Maintainer: Ed Peyton <edppeyton@gmail.com>
Description: Statically determine and visualize the function dependencies within and across packages. This may be useful for managing function dependencies across a code base of multiple R packages.
License: MIT + file LICENSE
URL: https://pkgdepR.org/
BugReports: https://github.com/edpeyton/pkgdepR/issues
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: visNetwork, dplyr, magrittr, viridisLite, scales, utils
NeedsCompilation: no
Packaged: 2024-11-19 07:09:19 UTC; User
Author: Ed Peyton ORCID iD [aut, cre]
Repository: CRAN
Date/Publication: 2024-11-19 07:50:02 UTC

pkgdepR: Statically Determine Function Dependencies Between Packages

Description

Statically determine and visualize the function dependencies within and across packages. This may be useful for managing function dependencies across a code base of multiple R packages.

Details

The only function you're likely to need from pkgdepR is deps, which returns an object of class pkgdepR.

An object of class pkgdepR is a list with three named objects:

funs

a data frame describing the functions. Contains columns id, label, package, exported, group, and name.

links

a data frame containing the linkages between functions. Contains columns from and to.

pkg

a character vector containing the packages explored.

Author(s)

Maintainer: Ed Peyton edppeyton@gmail.com (ORCID)

See Also

Useful links:


Imported magrittr forward-pipe operator

Description

Imported from magrittr.


Get all information on a namespace

Description

Get all information on a namespace

Usage

all_info_ns(ns)

Arguments

ns

A character representing the namespace to explore.

Value

A named list.


Get environment dependency object

Description

This function creates an object of class pkgdepR, representing the network of function calls between one or more packages.

Usage

deps(pkg, exported_only = FALSE)

Arguments

pkg

A character vector of the environments to explore. Should be on the search path. Cannot be base.

exported_only

Boolean. Whether to include non-exported functions.

Details

An object of class pkgdepR is a list with three named objects:

funs

a data frame describing the functions. Contains columns id, label, package, exported, group, and name.

links

a data frame containing the linkages between functions. Contains columns from and to.

pkg

a character vector containing the packages explored.

Value

An object of class pkgdepR.

Examples

library(pkgdepR)
deps(pkg = "pkgdepR")

Get functions from namespace

Description

Get functions from namespace

Usage

get_functions(ns)

Arguments

ns

A character representing the namespace to explore.

Value

A character vector of function names.


pkgdepR object

Description

An internal generic function. Methods for is.pkgdepR should only return TRUE if the class is pkgdepR.

Usage

is.pkgdepR(x)

Arguments

x

Object to be tested.

Value

Boolean. TRUE when x is of class pkgdepR.


Get namespace information

Description

Get namespace information

Usage

ls_namespace_info(ns, ...)

Arguments

ns

A character representing the namespace to explore.

...

Other arguments passed to ls.

Value

A character vector of the names to search for a given namespace.


Visualizing package dependencies

Description

This function is a simple wrapper for plotting a network visualization using visNetwork.

Usage

## S3 method for class 'pkgdepR'
plot(
  x,
  width = NULL,
  height = NULL,
  main = NULL,
  submain = NULL,
  alpha = 0.8,
  footer = NULL,
  background = "rgba(0, 0, 0, 0)",
  n,
  m,
  ...
)

Arguments

x

An object of class pkgdepR.

width

The width of the vis.js render.

height

The height of the vis.js render.

main

The title. To remove the title, pass list(text = NULL).

submain

The subtitle. To remove the subtitle, pass list(text = NULL).

alpha

A transparency value to use for colors. Must be between 0 and 1.

footer

A character or a named list. See visNetwork.

background

A background color. See visNetwork.

n

(Optional) The number of colours to request from viridis. Allows the user to set a more granular palette.

m

(Optional) The subset of colours of the custom palette (specified by n) to use in the plot.

...

Other arguments passed onto viridis.

Value

An object of classes visNetwork and htmlwidget.

Examples

library(pkgdepR)
deps(pkg = "pkgdepR") %>% plot(option = "E", direction = -1)
deps(pkg = "pkgdepR") %>% plot(option = "D", alpha = 0.5, main = list(text = NULL))
deps(pkg = "pkgdepR") %>% 
  plot(option = "D", alpha = 0.8, main = list(text = NULL)) %>% 
  visNetwork::visInteraction(dragNodes = FALSE)

Print pkgdepR object

Description

Print pkgdepR object

Usage

## S3 method for class 'pkgdepR'
print(x, ...)

Arguments

x

An object of class pkgdepR.

...

Redundant argument for consistency with method.

Value

No return value.


Summarise pkgdepR object

Description

Summarise pkgdepR object

Usage

## S3 method for class 'pkgdepR'
summary(object, ...)

Arguments

object

An object of class pkgdepR.

...

Redundant argument for consistency with method.

Value

No return value.