Skip to content

HRM 1.3.0: prepare CRAN resubmission - #1

Merged
happma merged 52 commits into
masterfrom
test
Aug 31, 2026
Merged

happma merged 52 commits into
masterfrom
test

Conversation

@happma

@happma happma commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Prepares HRM 1.3.0 for resubmission to CRAN, where the package was archived
on 2024-04-20 ("issues were not corrected despite reminders").

What caused the archival

The archived 1.2.1 depended on RGtk2 (orphaned and archived from CRAN on
2021-12-15) and tcltk, and declared SystemRequirements: C++11, which is
no longer accepted. All three are gone.

Breaking changes

  • GUI removed. hrm_GUI() and hrm.GUI() are gone with the RGtk2/tcltk
    dependency. The code was already commented out, but hrm.GUI() still
    called the nonexistent hrm_GUI().
  • Multivariate repeated measures removed. The variable= argument of
    hrm_test() no longer exists. It shipped with every assertion in its only
    test commented out. Code preserved under research/.
  • Depends → Imports. Loading HRM no longer attaches ggplot2,
    matrixcalc or plyr. Code passing theme objects to plot() must now
    attach ggplot2 itself.

Bug fixes

  • confint() was broken for every whole-plot design, parametric and
    nonparametric, including the example in the README. It aborted with
    missing value where TRUE/FALSE needed, caused by an upstream failure of
    mvtnorm::qmvnorm() on larger correlation matrices — dimension-driven and
    deterministic, not a rank problem (a full-rank 60x60 fails, a singular
    40x40 does not). It now degrades through four documented modes and reports
    which was used in attr(, "status"): global FWER, per-group FWER,
    per-group Sidak, or none. Results for designs without a whole-plot factor
    are bit-for-bit unchanged.
  • hrm_test.default was never registered and took no ..., so
    hrm_test() on an unsupported class gave R's generic "no applicable
    method" error instead of the intended message. Only R-devel/R-release
    caught this.
  • $ inside aes() produced eight deprecation warnings per plot call
    under ggplot2 4.0.
  • 16 help pages documented arguments that did not exist.
  • plot() on an unsupported design printed a message and returned
    invisibly; it now raises an error.

Housekeeping

  • Dependencies 9 → 6; xtable, tcltk, reshape2, RGtk2 dropped, MASS
    to Suggests. reshape2::melt replaced by data.table::melt, whose
    data.frame path is deprecated and announced to become an error.
  • R (>= 4.2.0), which is what the dependency tree can actually install on
    (pseudorank → doBy → R >= 4.2.0).
  • Compiled artefacts (src/*.o, src/HRM.dll) untracked; CRAN forbids
    binaries in source packages.
  • Author name corrected — person("Harrar W.", "Solomon") had given/family
    swapped; it is Solomon W. Harrar.
  • confint()'s correlation matrix used an O(m^4) loop; stats::cov2cor() is
    identical to 3.3e-16 and ~29000x faster.
  • Travis/AppVeyor replaced with GitHub Actions; R-hub workflow now tracked.
  • NEWS.md and cran-comments.md added.

Test coverage

Added tests/testthat/test_confint.R: the six regression values from 1.2.1
plus whole-plot coverage, which never existed — that gap is why the
confint() failure went unnoticed.

Check results

environment result
win-builder R-release (4.6.1) 1 NOTE
win-builder R-devel 1 NOTE
R-hub linux / macOS / windows (R-devel) OK
GitHub Actions ubuntu (oldrel-1) OK
local macOS, R 4.4.2 3 NOTEs (2 machine-local)

The remaining NOTE is New submission / Package was archived on CRAN,
which cannot be cleared, plus "possibly misspelled" Happ, et, al — a
surname and the citation form the submission checklist requires.

Note on the diff

This branch is 52 commits ahead of master, of which 35 predate this work
(earlier unmerged MVHRM development). The 17 commits from 96a3c00 onward
are the CRAN preparation.

happma and others added 22 commits October 23, 2019 12:34
The compiled objects src/*.o and src/HRM.dll were tracked in git. CRAN
policy forbids binary executables in source packages, and they are
regenerated on every build.

- untrack src/HRM.dll, src/RcppExports.o, src/u_statistics.o (kept on disk)
- .gitignore: add *.o, *.so, *.dylib, *.dll, *.Rcheck/, *.tar.gz, .claude/
- .Rbuildignore: fix the ^gitignore$ typo (matched nothing), add research/,
  cran-comments.md, .Rhistory, *.Rcheck, *.tar.gz
- inst/CITATION: citEntry() and personList() are deprecated; use bibentry()
  and c(). Add the DOI and switch the URL to https.
- src/RcppExports.cpp: regenerated with a current Rcpp (adds the
  RCPP_USE_GLOBAL_ROSTREAM guard).
- HRM.Rproj: ProjectId added by RStudio.
RGtk2 was orphaned and archived from CRAN on 2021-12-15. The GUI code had
already been commented out in R/GUI.R, but hrm.GUI() in deprecated.R still
called the now-nonexistent hrm_GUI(), which R CMD check flagged as
'no visible global function definition for hrm_GUI'.

- delete R/GUI.R (dead, entirely commented out) and its Rd files
- drop the hrm.GUI() stub from R/deprecated.R

BREAKING CHANGE: hrm_GUI() and hrm.GUI() are removed.
The multivariate branch was reachable through hrm_test(..., variable = ),
but its only unit test had every assertion commented out, so the code was
shipping untested. Moved to research/ rather than deleted.

- move R/MVHRM.R and tests/testthat/test_mv_1w_1s.R to research/
- drop the variable= argument from hrm_test.data.frame() and
  hrm_test_internal(); collapse the three if/else dispatches in
  Repeated.R to their univariate calls
- remove the now-dead x$variable branches from print.HRM and summary.HRM
  (the univariate constructors never set $variable)
- delete man/hrm.mv.*.Rd
- also relocates the pre-existing research script test_MVHRM.R

BREAKING CHANGE: the variable= argument of hrm_test() is removed.
confint() errors on every design with a whole-plot factor, including the
example printed in the README:

    z <- hrm_test(value ~ group*region*variable, subject = "subject", data = EEG)
    confint(z, level = 0.99)
    #> Error: missing value where TRUE/FALSE needed

The correlation matrix passed to mvtnorm::qmvnorm() is singular whenever a
group has fewer subjects than repeated measures (rank <= n_i - 1 < d). For
the example above it is 160x160 with rank 136. Verified still broken under
mvtnorm 1.3.6, so upgrading does not fix it.

The existing tests never caught this: all six confint assertions used 0
whole-plot designs, where the data pools into a single full-rank block.

- move R/conf_int.R and its example to research/, with the findings and a
  cov2cor() fix for the O(m^4) correlation loop noted in the header
- preserve the six removed assertions in research/test_confint.R
- add research/bug_confint_wholeplot.R as a reproducer
- unregister the S3 method and delete man/confint.HRM.Rd

BREAKING CHANGE: confint() on an HRM object is no longer available.
R CMD check reported 'Documented arguments not in \usage' for 16 Rd files:
roxygen @PARAM tags naming arguments the functions do not have.

- remove 15 stale @PARAM tags (group, factor1, factor2, factor)
- .E3()/.E4(): rename @PARAM i/M to the real M_i/M_j rather than deleting,
  which would have left the arguments undocumented
- move R/example_*.txt to inst/examples/*.R; files in R/ with non-R
  extensions were silently dropped from the tarball at build time.
  Verified all four Rd \examples blocks are byte-identical afterwards.
- man/HRM.Rd: rewritten. It carried a hardcoded version table stuck at
  1.0.2 / 2018 and a stale maintainer address (martin.happ@aon.at). Drop
  the table, list all authors with ORCID, use \doi{}, add the R Journal
  reference and \alias{HRM-package}.
- README: drop the GUI, multivariate and confint sections
Dependencies drop from 9 to 6. Depends is now only the R version, so
nothing is attached to the user's search path.

- reshape2 -> data.table for the single melt() call. Passing a data.frame
  to data.table::melt() is deprecated and announced to become an error, so
  as.data.table() first. Verified the plotted data is unchanged
  (all.equal TRUE, 160 rows, identical factor level order).
- move matrixcalc, plyr and ggplot2 from Depends to Imports; qualify the
  call sites outside R/ that relied on them being attached
  (matrixcalc::vec in test_matrices.R, ggplot2:: in test_plot.R and the
  plot example). Validated with _R_CHECK_DEPENDS_ONLY_=true.
- drop doBy and mvtnorm: both were used only by the withdrawn confint()
- drop unused imports: stats::qt, stats::pnorm, data.table::setDT.
  Rcpp::evalCpp is kept deliberately -- it is the standard idiom that
  ensures Rcpp is loaded, despite appearing unused.
- MASS to Suggests; it is used only by an example, via MASS::mvrnorm()
- Depends: R (>= 4.1.0). The old 3.5.0 floor was unmeetable anyway, since
  doBy required 4.2.0; with doBy gone, ggplot2 sets the floor at 4.1.
- DESCRIPTION: fix the author name (person("Harrar W.", "Solomon") had
  given/family swapped -- it is Solomon W. Harrar), drop the now-untrue
  'univariate or multivariate data' claim, https URLs, add Encoding
Travis-CI and AppVeyor have not run for years and their README badges were
broken. The R-hub workflow existed locally but was never committed, so it
was not on GitHub at all.

- add .github/workflows/R-CMD-check.yaml (r-lib/actions v2): macOS,
  Windows and Ubuntu on devel/release/oldrel-1, plus an explicit R 4.1 job
  covering the floor declared in DESCRIPTION, so that claim stays tested.
  Triggers on 'test' as well as main/master -- the upstream template only
  watches main/master and would never have run here.
- track the R-hub workflow for on-demand cross-platform checks
- delete .travis.yml and appveyor.yml
ggplot2 4.0 rebuilt ggplot objects on S7, so class() now returns five
elements instead of two:

  "ggplot2::ggplot" "ggplot" "ggplot2::gg" "S7_object" "gg"

All six assertions compared class() for exact equality with
c("gg", "ggplot") and failed on every CI platform with 'Lengths differ:
5 is not 2'. Locally they passed only because ggplot2 3.5.1 was installed.

Use inherits(p, "ggplot") instead, which holds under both. Verified
against ggplot2 4.0.2 in an isolated library: check is clean, tests pass.
Six platform jobs on every push to a development branch is more feedback
than it is worth. Collapse to a single Ubuntu job on the oldest supported
R, and keep the full matrix for pull requests into main/master, where the
cross-platform answer actually matters.
CI on R 4.1 could not resolve dependencies:

  * deps::.: Can't install dependency pseudorank (>= 0.3.7)
  * pseudorank: Can't install dependency doBy
  * doBy: Needs R >= 4.2.0

Dropping doBy as a direct dependency did not remove it: pseudorank
imports doBy, so it is still pulled in transitively and still sets the
floor at 4.2.0. The earlier 4.1.0 was derived from the R floors of direct
dependencies only, which was the wrong thing to measure.

- DESCRIPTION: Depends: R (>= 4.2.0)
- CI: test the floor at 4.2 instead of 4.1
R 4.2 fails too, one link further down the same chain: doBy imports Deriv,
and Deriv 4.3.0 uses R_ClosureFormals, which was added in R 4.5, while
declaring no R requirement of its own. So dependency resolution succeeds
and the build then fails at compile time.

Pin the job to oldrel-1 instead, which tracks a supported R. The declared
floor in DESCRIPTION is a separate open question.
confint() aborted for every design with a whole-plot factor, parametric
and nonparametric alike, including the example in the README:

    Error: missing value where TRUE/FALSE needed

mvtnorm::qmvnorm() fails once the correlation matrix gets large. It is an
upstream bug, not a rejection of the input: it depends on dimension
together with correlation structure, not rank (a full-rank 60x60 fails, a
singular 40x40 does not), and it is deterministic.

Rather than abort, try progressively weaker multiplicity control and report
which was used in attr(, "status"):

  1. FWER over all factor level combinations  (qmvnorm on all of R)
  2. FWER within each whole-plot group        (qmvnorm per block of R)
  3. Sidak correction within each group       (closed form)
  4. none                                     (interval columns are NA)

Designs without a whole-plot factor are unchanged: all six regression
values from 1.2.1 still hold to 1e-4.

Also replaces the O(m^4) correlation loop with stats::cov2cor(), identical
to 3.3e-16 and ~29000x faster, and adds the whole-plot test coverage that
never existed.
* add \value to plot.HRM and HRM-deprecated; CRAN asks for it on every
  exported object and R CMD check does not catch its absence
* plot() on an unsupported design used print() for a diagnostic and
  returned invisibly; policy wants a condition, so raise an error
* drop '?EEG' from the hrm_test example, which opened a help page mid-check
* NEWS.md documenting 1.3.0, including the breaking changes
* cran-comments.md explaining the 2024 archival and its fixes
Plotting emitted eight deprecation warnings per call under ggplot2 4.0:

  Use of `means$dimension` is discouraged.
  i Use `dimension` instead.

aes(x = means$dimension, ...) bypasses the data mask: the column is taken
from the calling frame rather than from the layer's data. Since data =
means is already supplied, reference the columns directly.

Uses .data$col rather than a bare col, which would otherwise trigger the
'no visible binding for global variable' NOTE. Verified against ggplot2
4.0.2: no warnings, plot unchanged (160 rows, 4 group colours).
win-builder (R-devel and R-release) reported:

  Mismatches for apparent methods not registered:
  hrm_test:
    function(data, ...)
  hrm_test.default:
    function(data)
  Apparent methods for exported generics not registered:
    hrm_test.default

hrm_test.default took no ... and was missing from NAMESPACE, so it was
never dispatched to: calling hrm_test() on an unsupported class produced
R's generic 'no applicable method' error rather than the intended message.

Local R 4.4.2 did not flag this; R-devel and R-release on win-builder did.

Also fixes the R Journal URL, which 301-redirects
(archive/2018/RJ-2018-032 -> articles/RJ-2018-032), and notes in
cran-comments.md that the DESCRIPTION spelling hits are false positives.
@happma
happma merged commit 559baa5 into master Aug 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant