Learn R Programming

havel (version 0.1.2)

uniq_pkg_deps: Count unique dependencies

Description

A function for package developers to count which direct dependencies add the most unique dependencies (direct plus downstream) in total.

Usage

uniq_pkg_deps(
  pkg,
  dep_type = c("depends", "imports", "linkingto"),
  pak_res = NULL,
  info_method = "pak",
  order = 1
)

Value

A data.table listing the packages, number of unique dependencies, and the unique dependencies themselves.

Arguments

pkg

a package to check

dep_type

type(s) of dependencies to look up. Valid values are c("depends", "imports", "linkingto")

pak_res

a pre-computed result from pak::pkg_deps

info_method

either "pak" or "tools". The latter will use tools::package_dependencies to look up package info.

order

Consider combinations of this many packages. Be careful going beyond 3.

Details

Use this function to tabulate which packages have the most unique downstream dependencies. For a package author, these are good targets to prioritize for removal if possible.

Because of the graph structure of dependencies, sometimes there isn't any one package that adds a lot of unique dependencies, but there is a PAIR or TRIPLET do. Set the order argument to check which pairs, triplets, etc have the most unique dependencies.

See Also

plot_deps_graph

Examples

Run this code
uniq_pkg_deps("ggplot2", pak_res = pkg_deps_ex$ggplot2)
# ^ scales adds the most unique dependencies to ggplot2 -- 6 including itself.
# The `pak_res` argument here is a pre-computed result to avoid internet
# access while running the examples on CRAN's servers. It's not required.

Run the code above in your browser using DataLab