pharmaR / riskassessment

Risk Assessment Demo App: https://rinpharma.shinyapps.io/riskassessment
https://pharmar.github.io/riskassessment/
Other
98 stars 26 forks source link

Adding "Suggests" pkgs to Dependencies tab #624

Closed AARON-CLARK closed 10 months ago

AARON-CLARK commented 11 months ago

Does {riskmetric} not provide a list of pkgs that fall into the "Suggests" field of the DESCRIPTION file? After chatting with @borgmaan, he shared that knowing those pkgs are really helpful because some orgs actually run a R CMD Check on a pkg and the "Suggests" pkgs are often needed to execute a pkg's tests.

image

broom's suggest field is extensive https://github.com/tidymodels/broom/blob/a579b0dcfc9f8feedb4e937bf336478c288852cc/DESCRIPTION#L556C6-L637

Suggests:
    AER,
    AUC,
    bbmle,
    betareg,
    biglm,
    binGroup,
    boot,
    btergm (>= 1.10.6),
    car,
    carData,
    caret,
    cluster,
    cmprsk,
    coda,
    covr,
    drc,
    e1071,
    emmeans,
    epiR,
    ergm (>= 3.10.4),
    fixest (>= 0.9.0),
    gam (>= 1.15),
    gee,
    geepack,
    ggplot2,
    glmnet,
    glmnetUtils,
    gmm,
    Hmisc,
    irlba,
    interp,
    joineRML,
    Kendall,
    knitr,
    ks,
    Lahman,
    lavaan,
    leaps,
    lfe,
    lm.beta,
    lme4,
    lmodel2,
    lmtest (>= 0.9.38),
    lsmeans,
    maps,
    margins,
    MASS,
    mclust,
    mediation,
    metafor,
    mfx,
    mgcv,
    mlogit,
    modeldata,
    modeltests,
    muhaz,
    multcomp,
    network,
    nnet,
    orcutt (>= 2.2),
    ordinal,
    plm,
    poLCA,
    psych,
    quantreg,
    rmarkdown,
    robust,
    robustbase,
    rsample,
    sandwich,
    spdep (>= 1.1),
    spatialreg,
    speedglm,
    spelling,
    survey,
    survival,
    systemfit,
    testthat (>= 2.1.0),
    tseries,
    vars,
    zoo
Robert-Krajcik commented 11 months ago

It looks like the {riskmetric} package only looks at Imports, Depends and LinkingTo

Here is one method for finding all the suggests across all packages loaded

package_names <- dbSelect("select * from package", db_name)$name
sugs <- unlist(tools::package_dependencies(package_names, available.packages(),
        which=c("Suggests"), recursive=FALSE)) %>% unique()
Jeff-Thompson12 commented 11 months ago

@Robert-Krajcik I would tack it onto the upload package process. That process currently grabs information from the tarball. Could easily grab the suggests then too.

Robert-Krajcik commented 11 months ago

Or the pkg_explorer mod Example using {dplyr}

pkg_name <- "dplyr"

ref <- riskmetric::pkg_ref(pkg_name,
                           source = "pkg_cran_remote")
ref_ver <- as.character(ref$version)

src_dir <- file.path("source", pkg_name)
if (!dir.exists(src_dir)) {
  utils::untar(file.path("tarballs", glue::glue("{pkg_name}_{ref_ver}.tar.gz")), exdir = "source")
} 
  dcf <- read.dcf(paste0(src_dir, "/DESCRIPTION"))
  sugs <- dcf[,"Suggests"] %>% gsub("\n", "", .) %>% unname()
Jeff-Thompson12 commented 11 months ago

The package explorer is set to only trigger if someone opens it because unpacking the tarballs takes time.

Robert-Krajcik commented 11 months ago

Yes I know. I am just borrowing some code from it

Jeff-Thompson12 commented 11 months ago

I guess I was thinking we should be storing this information upon uploading of the package so all our data is pointing to the same point in time.

Robert-Krajcik commented 11 months ago

Well the tools::package_dependencies() function sure is a whole lot faster than having to unpack a tarball. So what are your thoughts on how to approach this?

Jeff-Thompson12 commented 11 months ago

This line actually untar the tarball when uploading the package. The information should be available to grab in the source folder at that time. Probably need a safeguard in place in the event that there was an issue downloading the tarball.

AARON-CLARK commented 10 months ago

closed with #631