dstr_data: Get Various Aspects Of The Dependency Structure In The Form...

Description Usage Arguments Examples

View source: R/dstr_data.R

Description

This function returns certain information about the dependency structure of the package/s to be analyzed in the form of vectors, lists and data.frames. The different aspects of the dependency structure are provided by 11 different output types (set by the parameter 'outtypes', see description below). The default assumption is that there is an R package in the current working directory and that the dependencies to be analyzed are given in the DESCRIPTION file. Use the parameters <e2><80><98>githublink<e2><80><99> and/or 'pkg' to alter the package/s to be analyzed.

Usage

1
2
dstr_data(githublink = NULL, pkg = NULL, outtype,
  includebasepkgs = F, recursive = T)

Arguments

githublink

A link to a github repository of an R package.

pkg

Character vector of CRAN package name/s you want to see the dependencies of. In the case that githublink is also set, the github package is considered as the root package and the packages provided by the pkg parameter are considered to be first level packages, e.g. on the same level as the packages in the DESCRIPTION file of the github package. This is to help answer the question "How would the dependency structure change if the package on github would also depend on a few more packages (provided by the pkg parameter)?".

outtype

Possible output types:

Key data about the dependency structure:

  • 'root': The name of the package/s that the analysis is about (level 0 in the dependency tree)

  • 'lvl1': The dependencies that are given under "Imports:" or "Depends:" in the DESCRIPTION file of the root packge/s (level 1 in the dependency tree). They are also referred to as first level depdencies or first level packages. Dependencies of dependencies of ... (deeper level dependencies), which are not in the DESCRIPTION file, are NOT included.

  • 'all': An overview of all packages that are eventually loaded (all levels). No further structure visible.

  • 'tree': Detailed information about which package depends on which, represented in a data frame that is showing a tree structure.

Dependencies per first level dependency:

  • 'list': More detailed than 'all', it's a list that containns all packages per first level dependency.

  • 'list2': like 'list' but the first level dependencies are not only used for the names of the list elements but also included in the list elements

  • 'unique': like 'list', just excluding all packages, that are eventually also loaded by another first level package. This way you can see which dependencies will be removed completely if you remove a certain first level dependency (a package that you import).

  • 'unique2': like 'unique', but each first level dependency is included in the corresponding list element IF it is a unique dependency. E.g. If a certain first level dependency is a deeper level dependency from another first level dependency, the corresponding list entry will be character(0). This means that if you remove that certain first level dependency from your Imports/Depends in the DESCRIPTION file, you actually won't remove it from the whole dependency structure because another first level package still depends on it.

For plotting and network analysis:

  • edgelist: An edge list, e.g. to be used for network plots, including only level 1 and deeper level dependencies, not the root package/s.

  • edgelist2: An edge list, e.g. to be used for network plots, including the root package/s.

  • network: An igraph network object which can directly be plotted.

includebasepkgs

Whether to include base packages in the analysis or not.

recursive

If TRUE, the outputs go no deeper than level 3. The default of FALSE is probably the desired output in most cases.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Using a package in the local working directory
# setwd("path/to/package")
# dstr_data(outtype = c("all", "tree"))

# Using a package on github
network_object <- dstr_data(githublink= "tidyverse/ggplot2", pkg="dplyr",
 recursive = TRUE, includebasepkgs = FALSE, outtype = "network")

# needs package igraph attached:
# plot(network_object, edge.arrow.size = .1, edge.color="darkgrey",vertex.size = 10,
#           vertex.shape = "circle",vertex.frame.color = "white", vertex.label.font= 1,
#            vertex.label.color = "black", vertex.color = "white",edge.width = 1.5,
#            layout = layout_with_fr)

falo0/dstr documentation built on May 25, 2019, 4:26 p.m.