adokter / bioRad

R package for analysis and visualisation of biological signals in weather radar data
http://adokter.github.io/bioRad
Other
29 stars 16 forks source link

reduce number of dependencies (if possible) #131

Open adokter opened 6 years ago

adokter commented 6 years ago

We currently depend on 14 packages, which is quite a lot.

Check whether we can reduce this number

adokter commented 6 years ago

Especially check these packages, not directly clear to me whether there aren't workarounds such that these dependencies can be removed

adokter commented 6 years ago

@peterdesmet @stijnvanhoey help welcome here if you have time

peterdesmet commented 6 years ago

14 doesn't seem to be out of the ordinary. Another widely used package (rgbif) we contribute to has 12: https://github.com/ropensci/rgbif/blob/master/DESCRIPTION#L31-L43

But we can probably choose RCurl or curl rather than both?

stijnvanhoey commented 6 years ago

I agree on the Rcurl/curl redundancy. We probably can exclude lubridate with a small effort, but apart from those I can't see direct possibilities to exclude the other dependencies.

I assume for windows users the rgdal package installation could be a potential trouble-maker, but seems worhtwhile to include, no?

stijnvanhoey commented 6 years ago

Checking this a bit further on the develop branch dpendencies:

    curl,
    fields,
    ggmap,
    ggplot2,
    graphics,
    lubridate,
    methods,
    raster,
    RCurl,
    rgdal,
    rhdf5,
    sp,
    stats,
    utils,
    maptools

and the NAMESPACE:

import(fields)
import(ggmap)
import(ggplot2)
import(graphics)
import(methods)
import(rgdal)
import(rhdf5)
import(sp)
import(stats)
import(utils)
importFrom(RCurl,getBinaryURL)
importFrom(curl,curl_download)
importFrom(grDevices,col2rgb)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,rgb)
importFrom(lubridate,as_date)
importFrom(lubridate,floor_date)
importFrom(maptools,crepuscule)
importFrom(raster,raster)
importFrom(raster,rasterToPoints)
peterdesmet commented 5 years ago

I’m looking into #150.

peterdesmet commented 5 years ago

@adokter @stijnvanhoey if you want to investigate further how to reduce dependencies, especially:

  • Are we not missing grDevices in the DESCRIPTION file (R CMD CHECK should alert for this) RCurl - curl -> should be ok to drop one of them, as we only use a single function from each of them (make a separate issue and assign me, I'll try to have a look at it)
  • It would be good to be more explicit about the imports using importFrom instead of general import as to assess the necessity of each package

Then I would do that in 0.5.0

PietrH commented 6 months ago

Current status:

# Direct dependencies

tools::package_dependencies("bioRad")
#> $bioRad
#>  [1] "assertthat"   "curl"         "dplyr"        "fields"       "frictionless"
#>  [6] "ggplot2"      "glue"         "graphics"     "jsonlite"     "lubridate"   
#> [11] "lutz"         "methods"      "raster"       "readr"        "rhdf5"       
#> [16] "rlang"        "sp"           "stats"        "suntools"     "tidyr"       
#> [21] "utils"        "viridis"      "viridisLite"

# Recursive dependencies

tools::package_dependencies("bioRad", recursive = TRUE)
#> $bioRad
#>  [1] "assertthat"   "curl"         "dplyr"        "fields"       "frictionless"
#>  [6] "ggplot2"      "glue"         "graphics"     "jsonlite"     "lubridate"   
#> [11] "lutz"         "methods"      "raster"       "readr"        "rhdf5"       
#> [16] "rlang"        "sp"           "stats"        "suntools"     "tidyr"       
#> [21] "utils"        "viridis"      "viridisLite"  "tools"        "cli"         
#> [26] "generics"     "lifecycle"    "magrittr"     "pillar"       "R6"          
#> [31] "tibble"       "tidyselect"   "vctrs"        "spam"         "maps"        
#> [36] "httr"         "purrr"        "yaml"         "grDevices"    "grid"        
#> [41] "gtable"       "isoband"      "MASS"         "mgcv"         "scales"      
#> [46] "withr"        "timechange"   "Rcpp"         "terra"        "clipr"       
#> [51] "crayon"       "hms"          "vroom"        "cpp11"        "tzdb"        
#> [56] "lattice"      "sf"           "stringr"      "gridExtra"    "pkgconfig"   
#> [61] "mime"         "openssl"      "nlme"         "Matrix"       "splines"     
#> [66] "fansi"        "utf8"         "farver"       "labeling"     "munsell"     
#> [71] "RColorBrewer" "classInt"     "DBI"          "s2"           "units"       
#> [76] "dotCall64"    "stringi"      "bit64"        "progress"     "bit"         
#> [81] "e1071"        "class"        "KernSmooth"   "colorspace"   "askpass"     
#> [86] "prettyunits"  "wk"           "sys"          "proxy"

Created on 2024-05-03 with reprex v2.1.0

Another possible one is to drop glue and assertthat for cli which is already an recursive dependency. I'm also wondering if we need both viridis and viridisLite, possibly you could hardcode the palettes somewhere.