[jaspDistributions] Fix missing decimal points in data summary table for mixture of...#230
Open
sisyphus-jasp wants to merge 1 commit intojasp-stats:masterfrom
Open
Conversation
…for mixture of...
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
Fixes: https://github.com/jasp-stats/INTERNAL-jasp/issues/2961
Fix: Missing decimal points in data summary table
What was wrong
The summary table in the mixture of normals analysis (and all other distribution analyses) used the format
"sf:4"(4 significant figures) for numeric columns. When values were integers (e.g., variance=1, mean≈0, std.dev≈1), the jaspBase formatting did not display decimal points, showing "1" instead of "1.00" or "-0" instead of "-0.00".What was changed
File:
R/commonDiscoverDistributions.RChanged the format from
"sf:4"to"dp:2"for all numeric columns in the summary table:The
"dp:2"format specifies 2 decimal places, ensuring decimal points are always displayed for numeric values.Test results
The fix is minimal and focused on the specific issue. It affects the display format of the summary table in all distribution analyses that use the common
.ldSummaryContinuousTableMainfunction.Implementation Plan
Plan: Fix missing decimal points in data summary table
Root Cause
The summary table in
R/commonDiscoverDistributions.Ruses the format "sf:4" (4 significant figures) for numeric columns. When values are integers (e.g., 1, -1, -3), the jaspBase formatting doesn't display decimal points, showing "1" instead of "1.000".This is a known issue with the "sf" format for integer values - it doesn't add trailing zeros to show the specified significant figures.
Proposed Changes
File:
R/commonDiscoverDistributions.RChange: Replace
format = "sf:4"withformat = "dp:2"for all numeric columns in the summary table:The "dp:2" format specifies 2 decimal places, which will ensure decimal points are always shown for numeric values.
Expected Test Impact
The change may affect test expectations in the snapshot tests since the output format changes from significant figures to decimal places. However, the numeric values remain the same - only the display format changes.
The unit tests that check exact values in the table (like
test-ldmixturenormalnormal.R) should still pass as they check the raw numeric values, not the formatted display strings.Test Results