Add add_if_missing parameter to control NA handling in interpretive rules#264
Open
Add add_if_missing parameter to control NA handling in interpretive rules#264
add_if_missing parameter to control NA handling in interpretive rules#264Conversation
#259) When `add_if_missing = FALSE`, rules are only applied to cells that already contain an SIR value; `NA` cells are left untouched. This is useful with `overwrite = TRUE` to update reported results without imputing values for drugs that were not tested. https://claude.ai/code/session_01Nucc8nXGLqNUjtuC9GrhTc
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.
Summary
Added a new
add_if_missingparameter tointerpretive_rules()andeucast_rules()functions to provide fine-grained control over whether rules should be applied to missing (NA) values.Key Changes
add_if_missingparameter (default:TRUE) tointerpretive_rules()function signatureedit_sir()helper function to accept and handle theadd_if_missingparameteredit_sir()to use a unifiedapply_maskapproach that respects bothoverwriteandadd_if_missingsettingsedit_sir()is invoked)Implementation Details
The new parameter enables users to:
add_if_missing = TRUE(default): Apply rules to all cells, includingNAvalues (preserves existing behavior)add_if_missing = FALSE: Apply rules only to cells that already contain an SIR value, leavingNAcells untouchedThis is particularly useful when using
overwrite = TRUEwith custom rules to update reported results without imputing values for drugs that were not tested.The implementation consolidates the conditional logic for cell selection into a single
apply_maskvariable, improving code maintainability and reducing duplication in the warning handling section.https://claude.ai/code/session_01Nucc8nXGLqNUjtuC9GrhTc