You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clean up and improve expansion 1 plotting and reporting - #188
This pull request refactors and improves the codebase for expansion factor calculations and related plotting in several R functions. The main focus is on cleaning up NA and Inf handling, improving plot output and labeling, and making the code and user messaging more robust and clear. Below are the most important changes grouped by theme:
Refactoring NA/Inf Handling and User Messaging:
Simplified and clarified how NA values are tracked and reported in getExpansion_1(), removing handling of Inf values and focusing only on NA cases; updated user messages to reflect this, and now track NA replacements in a new replace_na column instead of the old replace_na_inf.
Removed verbose NA/Inf reporting and associated plot generation from EF1_Denominator(), streamlining output and focusing on relevant data. [1][2][3]
Plotting Improvements:
Updated plotting logic in getExpansion_1() to generate clearer boxplots for expansion factors by year and state, separated for lengths and ages, and removed obsolete NA/Inf barplots.
Overhauled the plots in EF1_Numerator(): replaced a boxplot of sample weights per trip with new barplots showing the proportion and count of samples with NA values in Trip_Sampled_Lbs by gear, year, and state; improved axis labeling, sizing, and facetting for better readability. [1][2]
Minor Code and Documentation Updates:
Updated a comment in getExpansion_1() to clarify the challenges of expanding WA data due to missing trip weights.
Added .positai and .claude to .Rbuildignore to exclude these directories from package builds.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Default verbose execution fails on an undefined counter, and the new plots can misrepresent missing-weight proportions and age-expansion distributions.
Count missing age expansions using Expansion_Factor_1_A
R/getExpansion_1.R:173
This age-specific count tests Expansion_Factor_1_L, so it counts missing length expansions rather than missing age expansions. If this count is retained for reporting, it should use Expansion_Factor_1_A; otherwise it is misleading dead code.
This issue also appears on line 174 of the same file.
Correct spelling of challenging
R/getExpansion_1.R:157
challanging is a spelling error in this newly updated comment; please use challenging.
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
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.
This pull request refactors and improves the codebase for expansion factor calculations and related plotting in several R functions. The main focus is on cleaning up NA and Inf handling, improving plot output and labeling, and making the code and user messaging more robust and clear. Below are the most important changes grouped by theme:
Refactoring NA/Inf Handling and User Messaging:
getExpansion_1(), removing handling of Inf values and focusing only on NA cases; updated user messages to reflect this, and now track NA replacements in a newreplace_nacolumn instead of the oldreplace_na_inf.EF1_Denominator(), streamlining output and focusing on relevant data. [1] [2] [3]Plotting Improvements:
getExpansion_1()to generate clearer boxplots for expansion factors by year and state, separated for lengths and ages, and removed obsolete NA/Inf barplots.EF1_Numerator(): replaced a boxplot of sample weights per trip with new barplots showing the proportion and count of samples with NA values inTrip_Sampled_Lbsby gear, year, and state; improved axis labeling, sizing, and facetting for better readability. [1] [2]Minor Code and Documentation Updates:
getExpansion_1()to clarify the challenges of expanding WA data due to missing trip weights..positaiand.claudeto.Rbuildignoreto exclude these directories from package builds.