-
Notifications
You must be signed in to change notification settings - Fork 37
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
Trailing insignificant digits not printed? #40
Comments
Yes |
Maybe we could print them if there's enough space? |
It was a deliberate choice. Maybe it's worth rethinking, as it does seem a bit arbitrary to not display digits when space is available, and sigfigs are highlighted using colour so it's still scannable. |
I believe the numbers should definitely be displayed in full if there's space, or at least otherwise notify the user that they have been modified. Wasn't one of the founding principles of plyr (and thus the genesis of the tidyverse in general) to not surprise the user (i.e. provide output consistent with input)? If I enter 1000.34 in my data entry, I certainly don't expect to see "1000". |
@dpeterson71 what do you expect |
In this case, If the computer is going to modify or change the data I have given it, it should at least have the courtesy to notify me that it has done so rather than blindly dropping information. |
My point is that no floating point number is exact - I don't think it's unreasonable for tibble to not print .34 when it's only a small part of the value. (BTW I don't like the principle of avoiding surprise; because different things surprise different people based on what they know) |
I don’t if my opnion is worth much, but FWIW, I too find the current behaviour very misleading. It makes it look like there are no non-zero decimals (up to the precision/width used). I’m OK with hiding trailing zeros (up to the precision used), but hiding trailing non-zeros is confusing. The current behaviour is: pillar::pillar(c(1000.34, 1000, 0.34567))
#> <dbl>
#> 1000
#> 1000
#> 0.346 I would be happy with this being rendered as either #> <dbl>
#> 1000.34
#> 1000
#> 0.346 or #> <dbl>
#> 1000.340
#> 1000.000
#> 0.346 But perhaps dropping the decimals could be restricted to integers (defined as numbers pillar::pillar(c(1000.34, 1000.000078, 1000, 0.34567))
#> <dbl>
#> 1000.340
#> 1000.000
#> 1000
#> 0.346 or (preferably?) pillar::pillar(c(1000.34, 1000.000078, 1000, 0.34567))
#> <dbl>
#> 1000.34
#> 1000.
#> 1000
#> 0.346 That is, omitting the |
I like the idea of using a trailing |
@huftis has two very good suggestions, in my opinion. My personal preference would be the first example, where the entries for doubles are justified: pillar::pillar(c(1000.34, 1000.000078, 1000, 0.34567)) #> <dbl> #> 1000.340 #> 1000.000 #> 1000 #> 0.346 The last option at least solves part of the issue where the careful observer might notice that the data has been modified by the subtle visual cue of a decimal point with missing digits. However, even though I could eventually learn to deal with that format, it is still harder to read and interpret with the uneven formatting and ragged edges. Our research group would never be allowed to present data that way in a public forum where readability and policy decisions matter. |
One last thought. Cleveland's seminal work on visualizing data led to many improvements in graphing parameters and paradigms. The excellent lattice and ggplot2 packages make use of many of his concepts. Similarly, Brewer's extensive work in cartography and color theory guides optimal use of color in visualizations. I wonder if there exists some cognitive research on effective presentation of tabular data? If not, perhaps there's something for data that's analogous to the Chicago or Oxford Manuals of Style that could guide default format choices? |
in my opinion this is extremely dangerous. I mean, I could honestly lose my job if I think I have 100 in my dataframe whereas I have 100.2 Formatting and color are fun, but this is way beyond that. |
How do you like the current output with the decimal dot always printed? |
This is what I get when I dont specify any option
and now if I run
Damn... I just want to see my full number
which is still rounding my numbers :( How can I disable this rounding + forced scientific formatting altogether? Again, rounding numbers like this is misleading and dangerous (if enabled by default). Perhaps some users may like that, I am pretty sure most people wont. Please let me know |
actually setting |
I'm glad that data.frame(x = 1000.000078)
#> x
#> 1 1000
sprintf("%.23f", 1000.000078)
#> [1] "1000.00007800000003044260666"
|
interesting. I think it would be worthwhile to educate the user about floating-point approximations here. Like you could share a link to http://floating-point-gui.de/basic/ on the main tibble page as a reminder/warning. |
@randomgambit I think it's wholly unfair to have folks need an understanding of floating point approximations in the beautification of tibble output. There's only once mention of floating points in the entirety of http://r4ds.had.co.nz/ and that's as wooly as possible. |
@martinjhnhadley come on, seriously? anybody can understand that, the point would be to say - look - you can control the |
I was the one who proposed the ‘trailing decimal point’ feature, but FWIW, I’m not happy with the way it has been implemented. The idea was to use the dot to indicate that ‘there is more here, but we’re not displaying all of it (because of lack of space)’. But the way it’s implemented is to add a trailing decimal dot for all So now only I still think the original idea made sense. It’s useful to see if a number is an integer (not necessarily an |
I really like the idea of the dot meaning there is more - but we dont see it. However, in practice, i will likely set enough significance digits so that I would always see a few digits in the decimal space. So that option would not impact me as much as the other ones. |
Closing in favor of #105. The dot will be shown only if |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
@hadley: Is this intended?
The text was updated successfully, but these errors were encountered: