Skip to content

Comments

check that ipred exists before adding to table#14

Merged
roninsightrx merged 4 commits intomainfrom
check-ipred-exist
Feb 21, 2026
Merged

check that ipred exists before adding to table#14
roninsightrx merged 4 commits intomainfrom
check-ipred-exist

Conversation

@roninsightrx
Copy link
Contributor

in create_model(), will now check whether the model actually has IPRED declared before adding to default tables.

Copy link
Contributor

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 adds validation for the IPRED variable before including it in default NONMEM output tables. IPRED is commonly used but not a reserved NONMEM variable, so it must be explicitly defined in the model. The PR ensures graceful handling when IPRED is not available.

Changes:

  • Modified check_nm_table_variables() to optionally return invalid variables instead of throwing an error
  • Updated add_default_output_tables() to check if IPRED exists before adding it to the fit table
  • Moved table addition in create_model() to occur after metabolite compartment modifications

Reviewed changes

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

File Description
man/check_nm_table_variables.Rd Updated documentation to reflect new throw_error parameter and return behavior
R/add_table_to_model.R Added throw_error parameter to check_nm_table_variables() to enable conditional validation
R/add_default_output_tables.R Added IPRED validation before including it in the fit table
R/create_model.R Moved table addition to occur after metabolite compartment modifications to ensure accurate IPRED validation
Comments suppressed due to low confidence (1)

R/add_default_output_tables.R:69

  • The variable assignment ipred <- NULL on line 69 is redundant since ipred is already NULL in the local scope (it's a new variable). While this doesn't cause incorrect behavior because NULL values are dropped when concatenating vectors, it would be clearer to remove this initialization and let ipred remain undefined, or explicitly initialize it at the beginning of the conditional block for better readability.
    ipred <- NULL

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

@roninsightrx roninsightrx merged commit 2366921 into main Feb 21, 2026
5 checks passed
@roninsightrx roninsightrx deleted the check-ipred-exist branch February 21, 2026 06:54
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