Skip to content

Add to nlmixr2plot fix - #53

Merged
mattfidler merged 5 commits into
mainfrom
in390
Aug 4, 2026
Merged

Add to nlmixr2plot fix#53
mattfidler merged 5 commits into
mainfrom
in390

Conversation

@mattfidler

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets a crash in prediction-corrected VPC plotting on censored (LLOQ/ULOQ) fits, where vpc can error in quantile() due to NA handling during pred-correction. It adds regression tests and documents the fix in the changelog.

Changes:

  • Add regression tests ensuring vpcPlot()/vpcPlotTad() with pred_corr=TRUE do not error on censored fits.
  • Add pre-filtering logic in the vpc-backend path to avoid NA-driven quantile() crashes when pred-correcting censored data.
  • Document the fix in NEWS.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/testthat/test-plots-cens.R Adds regression coverage for pred-corrected VPC/TAD VPC on censored fits.
R/vpcPlot.R Implements a workaround for vpc pred-correction + censoring NA/quantile() crash.
NEWS.md Records the user-visible bug fix in the development NEWS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/vpcPlot.R
Comment thread NEWS.md Outdated
@@ -1,5 +1,10 @@
# nlmixr2plot 5.0.2.9000

* Fixed a `quantile()` "missing values and NaN's not allowed" error in
mattfidler and others added 4 commits July 16, 2026 19:57
- vpcPlot(): drop pred-corrected censored rows with strict comparisons
  (DV > lloq / DV < uloq).  Censored records are encoded at the censoring
  limit, so the previous >=/<= kept those boundary rows and included them
  in the pred-corrected VPC, contradicting vpc's non-censored-only
  behavior (Copilot review).
- NEWS.md: fix "NaN's" -> "NaNs" (Copilot review).
- vpcPlot(): retain the `cens` column through the pred-corrected observed
  rebuild so `method = "tidyvpc", cens = TRUE` no longer errors that the
  observed data has no `cens` column; add regression tests.
- .Rbuildignore: ignore .git and .vexp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror nlmixr2est's test partitioning so push/PR R-CMD-check runs a minimal
essential subset that still exercises the core plotting surface, and the
expensive fit-heavy files run weekly.

- tests/testthat.R: add NLMIXR2PLOT_TEST_BATCH partitioning. On push/PR CI the
  essential subset runs every file EXCEPT the slow ones in .slowBatches
  (measured local run times: plots ~219s + gglist-integration ~12s stay
  essential; plots-multiple-endpoints ~527s, plots-cens ~62s and plots-bsv
  ~156s move to weekly).  Batch mode runs only the requested batch; locally and
  on CRAN everything runs.  Also cap threads/testthat parallelism on CI/CRAN.
- .github/workflows/slow-tests.yaml: new weekly (Sat 04:30 UTC) + manual
  workflow running the slow batches one at a time (max-parallel 1).
- .github/workflows/R-CMD-check.yaml: auto-cancel superseded in-progress runs
  to stop stale runs starving the runner pool (a cause of the exit-143
  "runner received a shutdown signal" failures).
- test-plots-multiple-endpoints.R: guard the multiple-endpoint augPred() call,
  which errors ("no applicable method ... nlmixr2FitCore") in some nlmixr2est
  versions, so the weekly batch still exercises the rest of the plots.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rename the batch-partitioning locals (.on_cran, .on_ci, .slow_batches,
.slow_all) to snake_case so object_name_linter / CodeFactor reports no style
issues.  No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mattfidler

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

@mattfidler
mattfidler merged commit 6fc6cc8 into main Aug 4, 2026
5 of 11 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.

2 participants