-
Notifications
You must be signed in to change notification settings - Fork 183
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
A lot of digits in shiny DT #1071
Comments
Hello, That's normal. The way you use to round the numbers is not correct: > x = round(runif(n = 10, min = 0.8, max = 0.85) / 0.01) * 0.01
> print(x, digits = 16)
[1] 0.8300000000000001 0.8200000000000001 0.8400000000000000 0.8400000000000000
[5] 0.8300000000000001 0.8000000000000000 0.8000000000000000 0.8400000000000000
[9] 0.8200000000000001 0.8400000000000000 |
But in the version R 4.2.3, the table did not show these digits |
Strange. I tried other ways but the problem occurs as well: x = round(runif(n = 10, min = 0.8, max = 0.85), 2)
print(x, digits = 16)
x = round(runif(n = 10, min = 0.8, max = 0.85) * 100) / 100
print(x, digits = 16) You should use |
No, each row has a unique round value |
Hmm that's annoying. Maybe you should use JavaScript then, the option |
In fact the easiest way is to get the rounded numbers as character strings and then to use the column-wise option |
Agree, I came to this conclusion and use as.character for all numeric columns before render DT |
The problem with |
After upgrading to R version 4.3.1 and DT 0.28, in shiny DT tables sometimes have a lot of digits, but in the dataframe the number is rounded - round(x / 0.01) * 0.01
It is not suitable to set a common number of digits for all row. Each row has a unique rounding step 0.1, 0.01, 0.001...
Stack Overflow
By filing an issue to this repo, I promise that
The text was updated successfully, but these errors were encountered: