Review the changed R package code with emphasis on methodological correctness, not style.
Use this for method changes, bug fixes that may affect inference, numerical refactors, API changes, or pre-PR review of an R package.
Focus on these questions:
- Statistical correctness
- Are the assumptions in the code consistent with the stated method?
- Are parameterizations clear and internally consistent?
- Are transformations, offsets, scales, and links handled correctly?
- Are quantities on the correct scale when returned, printed, or plotted?
- Are defaults scientifically reasonable?
- Are estimated quantities distinguishable from inputs, hyperparameters, and diagnostics?
- Are uncertainty-related quantities labeled clearly and computed on the intended scale?
- Are implicit assumptions hidden in preprocessing, normalization, filtering, or pseudocounts?
- Numerical stability and edge-case handling
- unstable subtraction, division, exponentiation, or log operations
- underflow/overflow risk
- division by zero or near-zero quantities
- unguarded
log, exp, softmax, or likelihood calculations
- singular or near-singular matrix operations
- poor behavior for very small sample sizes
- problems induced by extreme counts, sparsity, or heavy skew
- failure to handle ties, all-zero rows, empty groups, or one-level factors
- silent recycling, coercion, or factor conversion issues
- missing handling for
NA, NaN, Inf, -Inf
- Package behavior
- Are exported vs internal functions appropriate?
- Are function names, arguments, and defaults coherent?
- Are argument checks informative and early?
- Are return values stable and documented?
- Is backward compatibility preserved where reasonable?
- Are S3/S4 methods registered correctly if relevant?
- Are dependencies necessary and minimal?
- Are examples safe, fast, and reproducible?
- Tests
- Propose the smallest regression and edge-case tests that would catch real breakage.
- Prefer one minimal regression test over broad test-suite rewrites unless clearly needed.
- Documentation
- Flag roxygen, examples, README, vignettes, and NEWS items that no longer match behavior.
Return exactly these sections:
Summary
2-4 sentences on what changed and the main risk.
Major issues
For each issue, give:
- Issue
- Why it matters
- Smallest fix
Suggested tests
List the minimal tests to add or update.
Documentation updates
List docs or examples that should be updated.
Nice-to-have improvements
Optional cleanup that is not required for correctness.
Behavior:
- Be skeptical about scientific correctness, not just syntax.
- Prefer the smallest correct patch.
- Distinguish correctness issues from maintainability issues.
- If uncertain, say exactly what is uncertain.
- Review first; do not start editing unless explicitly asked.
1---2name: r-package-methods-check3description: Review R package method changes for statistical correctness, numerical robustness, API stability, tests, and docs.4---56Review the changed R package code with emphasis on **methodological correctness**, not style.78Use this for method changes, bug fixes that may affect inference, numerical refactors, API changes, or pre-PR review of an R package.910Focus on these questions:11121. Statistical correctness13- Are the assumptions in the code consistent with the stated method?14- Are parameterizations clear and internally consistent?15- Are transformations, offsets, scales, and links handled correctly?16- Are quantities on the correct scale when returned, printed, or plotted?17- Are defaults scientifically reasonable?18- Are estimated quantities distinguishable from inputs, hyperparameters, and diagnostics?19- Are uncertainty-related quantities labeled clearly and computed on the intended scale?20- Are implicit assumptions hidden in preprocessing, normalization, filtering, or pseudocounts?21222. Numerical stability and edge-case handling23- unstable subtraction, division, exponentiation, or log operations24- underflow/overflow risk25- division by zero or near-zero quantities26- unguarded `log`, `exp`, `softmax`, or likelihood calculations27- singular or near-singular matrix operations28- poor behavior for very small sample sizes29- problems induced by extreme counts, sparsity, or heavy skew30- failure to handle ties, all-zero rows, empty groups, or one-level factors31- silent recycling, coercion, or factor conversion issues32- missing handling for `NA`, `NaN`, `Inf`, `-Inf`33343. Package behavior35- Are exported vs internal functions appropriate?36- Are function names, arguments, and defaults coherent?37- Are argument checks informative and early?38- Are return values stable and documented?39- Is backward compatibility preserved where reasonable?40- Are S3/S4 methods registered correctly if relevant?41- Are dependencies necessary and minimal?42- Are examples safe, fast, and reproducible?43444. Tests45- Propose the **smallest** regression and edge-case tests that would catch real breakage.46- Prefer one minimal regression test over broad test-suite rewrites unless clearly needed.47485. Documentation49- Flag roxygen, examples, README, vignettes, and NEWS items that no longer match behavior.5051Return exactly these sections:5253## Summary542-4 sentences on what changed and the main risk.5556## Major issues57For each issue, give:58- Issue59- Why it matters60- Smallest fix6162## Suggested tests63List the minimal tests to add or update.6465## Documentation updates66List docs or examples that should be updated.6768## Nice-to-have improvements69Optional cleanup that is not required for correctness.7071Behavior:72- Be skeptical about scientific correctness, not just syntax.73- Prefer the smallest correct patch.74- Distinguish correctness issues from maintainability issues.75- If uncertain, say exactly what is uncertain.76- Review first; do not start editing unless explicitly asked.