Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Infelicities with scientific_format() #7
Re: scientific_format() output vs. comma_format() output
Issue: comma_format()(number) does a better job of outputting scientific notation than scientific_format().
This behavior was triggered while testing graphics examples in the scales package.
Simple examples using comma_format():
More examples with scientific_format:
It seems a minimum number of trailing digits is necessary to trigger the expected output in scientific_format(). I'll write up some tests using these examples. Similar examples using comma_format():
I put that bug report up at Hadley's request as I've been going over the examples in the scales and ggplot2 packages for future documentation purposes. I had noticed the difference between the format() and formatC() in the two functions. I had commented to Hadley after running the examples that comma_format() was generating scientific notation more reliably than scientific_format(), but when cranking out examples for the bug report, it became clearer to me that the number of digits of desired precision certainly plays a role in all of this. I'll look more closely into format() and formatC() - thanks for the comments.
I'm just starting in on all of this, so I have a lot to learn. I'm way behind the 8-ball with respect to grid and some of the programming constructs in R relative to the rest of you, so please be patient with what will probably seem like naive and silly questions at times on my part.
The issue is that format() used by scientific() decides whether to use scientific notation or not (parameter scientific), whereas formatC() used by comma() has no such option. I guess using formatC for both would make sense.
Reply to this email directly or view it on GitHub: