# Dependency graph

#### Authors: Brian Schilder, Alan Murphy, Nathan Skene

####

#### Vignette updated: Jan-12-2023

# Contents

    requireNamespace("htmltools")
    library(data.table)

A dependency graph for all GitHub repos that use the `rworkflows` GitHub Action.

# 1 Create

Here is the code for creating the plot.

## 1.1 Install required packages

    if(!require("echodeps"))remotes::install_github("RajLabMSSM/echodeps",
                                                    dependencies = TRUE)

## 1.2 Create graph

    res <- echodeps::dep_graph(pkg = "rworkflows",
                               method = "github",
                               shape = "hexagon",
                               exclude = c("neurogenomics_rworkflows",
                                           "neurogenomics_r_workflows"),
                               node_size = "total_downloads",
                               reverse = TRUE,
                               save_path = here::here("reports","rworkflows_depgraph.html"))

## 1.3 Save data

    dgc_out$metadata

    saveRDS(res, here::here("reports","dgc_out.rds"))

## 1.4 Count stars/clones/views

    cols <- c("stargazers_count",
              "clones_count","clones_uniques","indirect_clones_uniques",
              "views_count","views_uniques","indirect_views_uniques",
              "total_downloads","indirect_total_downloads",
              echogithub::r_repos_opts())
    cols <- cols[cols %in% names(res$metadata)]

    metadata_counts <- data.frame(
      total=res$metadata[repo!="rworkflows",
                             lapply(.SD, sum, na.rm=TRUE),
                             .SDcols=cols] |> t()
      )
    metadata_counts

# 2 Show

Hover over each node to show additional metadata.

    htmltools::includeHTML("https://github.com/neurogenomics/rworkflows/raw/master/reports/rworkflows_depgraph.html")

visNetwork
¶
¶
¶

# 3 Identify high-impact packages

Identify the CRAN/Bioc R packages with the most number of downloads. This guides which packages would be the most useful to focus on implementing `rworkflows` in.

    pkgs <- echogithub::r_repos_downloads(which = c("CRAN","Bioc"),
                                          nThread = 10)

    pkgs <- pkgs[!is.na(downloads),]
    data.table::setkeyv(pkgs,c("r_repo","downloads"))
    pkgs_top <- pkgs[, tail(.SD, 10), by="r_repo"]
    methods::show(pkgs_top)

# 4 Session Info

    utils::sessionInfo()

    ## R version 4.2.1 (2022-06-23)
    ## Platform: x86_64-apple-darwin17.0 (64-bit)
    ## Running under: macOS Big Sur ... 10.16
    ##
    ## Matrix products: default
    ## BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
    ## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
    ##
    ## locale:
    ## [1] C/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
    ##
    ## attached base packages:
    ## [1] stats     graphics  grDevices utils     datasets  methods   base
    ##
    ## other attached packages:
    ## [1] data.table_1.14.6 BiocStyle_2.26.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] bookdown_0.31       digest_0.6.31       R6_2.5.1
    ##  [4] lifecycle_1.0.3     jsonlite_1.8.4      magrittr_2.0.3
    ##  [7] evaluate_0.19       stringi_1.7.8       cachem_1.0.6
    ## [10] rlang_1.0.6         cli_3.5.0           jquerylib_0.1.4
    ## [13] bslib_0.4.2         vctrs_0.5.1         rmarkdown_2.19
    ## [16] tools_4.2.1         stringr_1.5.0       glue_1.6.2
    ## [19] xfun_0.36           yaml_2.3.6          fastmap_1.1.0
    ## [22] compiler_4.2.1      BiocManager_1.30.19 htmltools_0.5.4
    ## [25] knitr_1.41          sass_0.4.4