Cirad-ASTRE / mapMCDA

Produce an epidemiological risk map by weighting multiple risk factors
https://umr-astre.pages.mia.inra.fr/mapMCDA/
1 stars 2 forks source link

Optimise package dependencies #36

Open famuvie opened 5 years ago

famuvie commented 5 years ago

We currently (v0.4-10) depend directly on 19 packages. Taking into account the recursive dependencies, this implies a longer installation time and more importantly, a lot of opportunities for problems at installation or working time.

Furthermore, I'm quite sure that many dependencies have been introduced for convenience, but can be easily circumvented (e.g. stringr).

famuvie commented 5 years ago

See packages itdepends and pkgdepends

famuvie commented 5 years ago

E.g., number of functions in mapMCDA were we use a given package

pacman::p_load(itdepends, dplyr)
dep_usage_pkg("mapMCDA") %>% count(pkg, sort = TRUE)
#> # A tibble: 13 x 2
#>    pkg            n
#>    <chr>      <int>
#>  1 base         608
#>  2 raster        27
#>  3 sp            26
#>  4 mapMCDA       14
#>  5 igraph         7
#>  6 stats          7
#>  7 utils          5
#>  8 methods        3
#>  9 deldir         2
#> 10 rgdal          2
#> 11 geonetwork     1
#> 12 graphics       1
#> 13 maptools       1

Created on 2019-06-05 by the reprex package (v0.3.0)

See: https://www.tidyverse.org/articles/2019/05/itdepends/

famuvie commented 5 years ago

Here is the tree of recursive mapMCDA dependencies (80). Packages in light green are the recursive dependencies of absolutely necessary packages. They cannot be avoided. Packages in purple are to be considered.

mapMCDA_dependencies.pdf

It shows a couple of dependencies that could be removed but with very little gain. For instance maps, which does not depend on anything itself, or plyr which depends on Rcpp but which is in turn required upon by several other important mapMCDA dependencies such as shinydashboard, shinyFiles or geonetwork.

The most promising candidate is geojsonio which brings in as much as 15 other packages that would be removed after him.