Skip to content

Model selection and reporting helpers#80

Open
billdenney wants to merge 4 commits intomainfrom
aic-helpers
Open

Model selection and reporting helpers#80
billdenney wants to merge 4 commits intomainfrom
aic-helpers

Conversation

@billdenney
Copy link
Contributor

I found functions like these very helpful for my day-to-day reporting needs, so I thought I'd make them generally available.

@mattfidler mattfidler requested a review from Copilot June 16, 2025 14:37
Copy link

Copilot AI left a comment

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 introduces a set of helper functions and supporting documentation to facilitate model selection and reporting. Key changes include the addition of a vignette outlining reporting helpers, new functions (getMinAICFit, isBoundaryFit, listModelsTested) with associated tests and documentation, and updates to the package namespace and DESCRIPTION.

Reviewed Changes

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

Show a summary per file
File Description
vignettes/reporting-helpers.Rmd Added a vignette demonstrating reporting helper functions
vignettes/.gitignore Updated ignore patterns for vignette-generated files
tests/testthat/test-AICHelpers.R Added tests verifying behavior of model selection helper functions
man/*.Rd Added documentation files for getMinAICFit, isBoundaryFit, and listModelsTested
R/AICHelpers.R Introduced helper functions for model selection and reporting
NAMESPACE & DESCRIPTION Exported new functions and updated package metadata

R/AICHelpers.R Outdated
args <- list(...)
fitList <- list()
for (currentArg in args) {
if (is.list(fitList) && inherits(try(AIC(currentArg), silent = TRUE), "try-error")) {
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

The condition incorrectly checks 'is.list(fitList)' instead of 'is.list(currentArg)', which may lead to improper expansion of list arguments. Consider replacing 'is.list(fitList)' with 'is.list(currentArg)' to correctly handle nested lists of fits.

Suggested change
if (is.list(fitList) && inherits(try(AIC(currentArg), silent = TRUE), "try-error")) {
if (is.list(currentArg) && inherits(try(AIC(currentArg), silent = TRUE), "try-error")) {

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

is.list(fitList) is always true

@@ -0,0 +1,2 @@
*.html
*.R
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

Double-check if ignoring '*.R' files in the vignettes directory is intentional, as it may inadvertently exclude necessary vignette source files needed during documentation builds. If this is by design, consider adding an explanatory comment to clarify the rationale.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is part of the default usethis::use_vignette() setup.

@mattfidler
Copy link
Member

Again, other than the issue reported by copilot, this looks good to me and may be helpful to others.

I'm unsure why the checks fail, though.

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.

3 participants