Skip to content

Code hygiene: imports, deprecated ggplot2/scales APIs, loops, progress bars, roxygen #211

Closed

Description

@feralaes

Suggested owner: Jorge Roa (or a newer contributor) · Plan: Phase 2b

Goal

Remove the deprecation warnings and latent errors that will break on future ggplot2 or R versions, and that JOSS and CRAN reviewers notice.

Scope

  • cor() is used but not imported (R/psa.R:215, R/psa.R:306). Add @importFrom stats cor. The NAMESPACE imports other stats functions but not cor.
  • trans =, soft-deprecated since ggplot2 3.5 (R/add_common_aes.R:208, R/add_common_aes.R:221): switch to transform =. This needs ggplot2 (>= 3.5.0) in DESCRIPTION; see DESCRIPTION authors, dependency bounds, and CITATION refresh #213.
  • scales::trans_new() is superseded (R/owsa.R:300-302, offset_trans): use scales::new_transform().
  • .groups = "drop_last" passed to group_by(), where it creates a dummy column (R/owsa.R:353, R/owsa.R:356, R/owsa.R:361). It belongs in summarize().
  • Loops of the form for (i in 1:n) that misbehave when n == 0: use seq_len() / seq_along(). The calculate_icers site is handled by Guard calculate_icers empty input and remove stale roxygen #178.
    • R/ceac.R:79, R/ceac.R:289
    • R/create_sa.R:76
    • R/evpi.R:45, R/evppi.R:93, R/evsi.R:173
    • R/gen_psa_samp.R:147, R/gen_psa_samp.R:230, R/gen_psa_samp.R:358 (the last is 1:(n.params - 1))
    • R/icers.R:95
    • R/run_dsa.R:108, R/run_dsa.R:135, R/run_dsa.R:155, R/run_dsa.R:305, R/run_dsa.R:318
    • R/run_psa.R:106, R/run_psa.R:118
  • Progress bars are never closed (R/run_dsa.R:119, R/run_dsa.R:289): add on.exit(close(pb)).
  • rdirichlet() roxygen tags are indented and therefore ignored (R/gen_psa_samp.R:273-275, #' @importFrom / #' @return / #' @export). Reproduced: dampack::rdirichlet is "not an exported object". Decide whether to export it or mark it @keywords internal, then fix the indentation.

Acceptance

  • devtools::check() shows no new NOTEs.
  • Running the tests with options(lifecycle_verbosity = "error") raises no ggplot2/scales deprecation warnings.
  • seq_len() changes are covered by existing tests, plus at least one 0-length test where reachable.

Activity

  1. added this to the v1.1.0 milestone on Nov 12, 2026
  2. added a commit that references this issue on Nov 13, 2026
  3. feralaes commented on Nov 13, 2026

    @feralaes
    CollaboratorAuthor

    Done in #224 (merged Nov 13, 2026), with the NEWS entry in #240: qualified cor() import, ggplot2's transform and scales::new_transform() (with minimum versions ggplot2 ≥ 3.5.0 and scales ≥ 1.3.0), .groups moved out of group_by(), seq_len()/seq_along() loops, progress bars closed, and the rdirichlet() roxygen fixed. rdirichlet() stays internal (@keywords internal), which matches what the NAMESPACE has always done; if the team prefers to export it, that can be a one-line follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions