cranly provides core visualisations and summaries for the CRAN package database. It is aimed mainly as an analytics tool for developers to keep track of their CRAN packages and profiles, as well as those of others, which, at least for me, is proving harder and harder as the CRAN ecosystem grows.
The package provides comprehensive methods for cleaning up and organising the information in the CRAN package database, for building package directives networks (depends, imports, suggests, enhances) and collaboration networks, and for computing summaries and producing interactive visualisations from the resulting networks. Network visualisation is through the visNetwork package. The package also provides functions to coerce the networks to igraph https://CRAN.R-project.org/package=igraph objects for further analyses and modelling.
This vignette is a tour to the current capabilities in cranly.
Download today’s CRAN database
Next we need to clean and organise author names, depends, imports, suggests, enhances
The resulting dataset carries the timestamp of when it was put together, which helps keeping track of when the data import has taken place and will be helpful in future versions when dynamic analyses and visualisation methods are implemented.
We can now extract edges and nodes for the CRAN package directives network by simply doing
and compute various statistics for the package network
## Global package network statistics
package_summaries <- summary(package_network)
#> Warning in closeness(cranly_graph, normalized = FALSE): At centrality.c:
#> 2784 :closeness centrality is not well-defined for disconnected graphs
The package_summaries
object can now be used for finding the top-20 packages according to various statistics
The sub-network for my packages can be found using the extractor function package_of
which use exact matching by default
my_packages <- package_by(package_network, "Ioannis Kosmidis")
my_packages
#> [1] "PlackettLuce" "betareg" "brglm" "brglm2"
#> [5] "enrichwith" "profileModel" "trackeR"
We can now get an interactive visualisation of the sub-network for my packages using
You can hover over the nodes and the edges to get package-specific information and links to the package pages.Next let’s build the CRAN collaboration network
Statistics for the collaboration network can be computed using the summary
method as we did for package directives.
author_summaries <- summary(author_network)
#> Warning in closeness(cranly_graph, normalized = FALSE): At centrality.c:
#> 2784 :closeness centrality is not well-defined for disconnected graphs
The top-20 collaborators according to various network statistics are
The R Core’s collaboration sub-network is
and my (small but valuable to me!) collaboration sub-network is