Skip to content

Fix/data viewer display - #1738

Merged
eitsupi merged 3 commits into
masterfrom
fix/data-viewer-display
Sep 20, 2026
Merged

eitsupi merged 3 commits into
masterfrom
fix/data-viewer-display

Conversation

@Fred-Wu

@Fred-Wu Fred-Wu commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Closes #1463
Closes #1408

  1. The fix disables JSON's default decimal rounding for all numeric values. AG Grid continues to use JS default formatting, which switches to scientific notation below 1e-6.

    1.54e-5 would appear as 0.0000154 in the data viewer instead of 0.
    1.54e-7 would appear as 1.54e-7 in the data viewer.

  2. The fix adds one shared formatting function that calls R's format() generic to use each class's formatting method when displaying its values. If a class does not implement a format.xxx() method, R uses format.default() by default.

@Fred-Wu
Fred-Wu requested a review from eitsupi September 20, 2026 04:07

@eitsupi eitsupi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add a regression test for an S4 numeric subclass?
The new synthetic class test is S3, whereas lubridate::Period is an S4 class extending numeric, which is the exact shape that previously fell into the numeric-column branch.
A minimal synthetic S4 class would test the new is.object() behavior without adding lubridate as a dependency.

Comment thread sess/inst/tinytest/test-dataview.R
@Fred-Wu

Fred-Wu commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Could we also add a regression test for an S4 numeric subclass? The new synthetic class test is S3, whereas lubridate::Period is an S4 class extending numeric, which is the exact shape that previously fell into the numeric-column branch. A minimal synthetic S4 class would test the new is.object() behavior without adding lubridate as a dependency.

I will add a test for that. But the fix should be general for numeric values with an arbitrary class, which is based on both is.numeric() and is.object() checks. If both are TRUE, they will enter textColumn branch and values will get formatted based on the class's format() method.

@eitsupi
eitsupi merged commit a4b8b77 into master Sep 20, 2026
5 checks passed
@eitsupi
eitsupi deleted the fix/data-viewer-display branch September 20, 2026 21:36
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.

View() displays sets some numerical values to 0 View() fails to handle lubridate Period objects within a data structure

2 participants