Skip to content

[jaspDistributions] Fix missing decimal points in data summary table for mixture of...#230

Open
sisyphus-jasp wants to merge 1 commit intojasp-stats:masterfrom
sisyphus-jasp:fix-sisyphus-1772000772
Open

[jaspDistributions] Fix missing decimal points in data summary table for mixture of...#230
sisyphus-jasp wants to merge 1 commit intojasp-stats:masterfrom
sisyphus-jasp:fix-sisyphus-1772000772

Conversation

@sisyphus-jasp
Copy link

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.R

Changed the format from "sf:4" to "dp:2" for all numeric columns in the summary table:

  • mean
  • variance
  • standard deviation
  • minimum
  • 25% quantile
  • median
  • 75% quantile
  • maximum

The "dp:2" format specifies 2 decimal places, ensuring decimal points are always displayed for numeric values.

Test results

  • All 432 tests pass
  • 2 tests skipped (platform-specific: Laplace, Triangular)
  • No failures or warnings

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 .ldSummaryContinuousTableMain function.

Implementation Plan

Plan: Fix missing decimal points in data summary table

Root Cause

The summary table in R/commonDiscoverDistributions.R uses 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.R

Change: Replace format = "sf:4" with format = "dp:2" for all numeric columns in the summary table:

  • Line 119: mean
  • Line 120: var
  • Line 121: sd
  • Line 122: min
  • Line 123: quantile25
  • Line 124: median
  • Line 125: quantile75
  • Line 126: max

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

Test Run Result
Baseline (pre-fix) [ FAIL 0 | WARN 0 | SKIP 2 | PASS 432 ]
Post-fix [ FAIL 0 | WARN 0 | SKIP 2 | PASS 432 ]
Upstream CI 297d7e4 -- CI: passing

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