check that ipred exists before adding to table#14
Merged
roninsightrx merged 4 commits intomainfrom Feb 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 <- NULLon line 69 is redundant sinceipredis 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 letipredremain 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
in
create_model(), will now check whether the model actually has IPRED declared before adding to default tables.