Skip to content

Data Explorer - scientific notation - does not adhere to options(scipen = xxx) #4818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
benhmin opened this issue Sep 25, 2024 · 5 comments · May be fixed by #7266
Open

Data Explorer - scientific notation - does not adhere to options(scipen = xxx) #4818

benhmin opened this issue Sep 25, 2024 · 5 comments · May be fixed by #7266
Labels
area: data explorer Issues related to Data Explorer category. enhancement New feature or request lang: r support
Milestone

Comments

@benhmin
Copy link

benhmin commented Sep 25, 2024

System details:

Positron and OS details:

Positron Version: 2024.09.0 (Universal) build 27
Code - OSS Version: 1.92.0
Commit: d996153
Date: 2024-09-11T02:38:46.408Z
Electron: 30.1.2
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

Interpreter details:

R 4.4.1

Describe the issue:

I am trying to use Positron for some data wrangling and the data explorer is great in general. However, I have multiple columns in various data frames that are of the type "double". These are typically 9-digit integers in my data, but this happens when they grow to over 7 digits.

The data explorer seems to always want these doubles in scientific notation. I have tried specifying the option(scipen=999) without any change.

If I change the data type of a column to integer then the scientific notation goes away.

I have found no setting in Positron nor anything on the google that gives me a hint that there is a setting somewhere else.

In RStudio if I set the scipen option and then run View(x) on a data frame it will respect the scipen option in the display.

Steps to reproduce the issue:

options(scipen = 999)
test_data <- data.frame(
                    order_proc_id = as.double(sample(11528843:11528943, 100, replace = TRUE)),
                    order_inst = sample(seq(as.POSIXct('2020-01-01'), as.POSIXct('2023-01-01'), by="day"), 100, replace = TRUE),
                    department_name_ahpl_combined = sample(c("Cardiology", "Neurology", "Oncology", "Pediatrics"), 100, replace = TRUE)
                ) |> View()

Expected or desired behavior:

Data Explorer should display numeric data in accordance with the scipen option setttings.

Were there any error messages in the UI, Output panel, or Developer Tools console?

@jmcphers jmcphers added area: data explorer Issues related to Data Explorer category. lang: r labels Sep 25, 2024
@jmcphers
Copy link
Collaborator

I can reproduce this (thanks for the example!).

Positron

image

RStudio

image

@jmcphers jmcphers added the enhancement New feature or request label Sep 25, 2024
@juliasilge juliasilge added this to the Future milestone Sep 30, 2024
@kv9898
Copy link
Contributor

kv9898 commented Apr 15, 2025

@lijiaqi-github, this seems to be the code responsible for this:

this._dataFormatOptions = {
large_num_digits: 2,
small_num_digits: 4,
max_integral_digits: 7,
max_value_length: 1000,
thousands_sep: '',
};

@kv9898
Copy link
Contributor

kv9898 commented Apr 15, 2025

It seems that it is rather more difficult to track the R scipen option than provide a language-agnostic setting entry in Positron for all data explorers. I think the latter would suffice, if I understood the issue correctly?

@lijiaqi-github
Copy link

It seems that it is rather more difficult to track the R scipen option than provide a language-agnostic setting entry in Positron for all data explorers. I think the latter would suffice, if I understand the issue correctly?

Sometimes I need to work with long strings of numbers in my dataset, like area codes + personal identification code (This number often is made very long) or the probability predicted by a model. The scientific notation in the data viewer makes them hard to read. It would be really helpful if they could be displayed as plain numbers instead.
Therefore, I vote for a global 'scipen' option. @juliasilge @kv9898

@kv9898
Copy link
Contributor

kv9898 commented Apr 16, 2025

#7266 proposes to add global scipen configuration to Positron data explorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: data explorer Issues related to Data Explorer category. enhancement New feature or request lang: r support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants