Printing numbers with separators in R
20 Feb 2015
I have been working with fairly large numbers in R (though mixed with numbers of “ordinary size”). To help with reading them I wanted thousands and higher separators to be printed. This shows one way to achieve this.
Here is some test data.
These number are large enough that it is easy to miss the actual order between them. When printed using
day1 day2 128,675,575 91,892,653
Clearly showing that the first has one more digit than the second.
When using the magrittr package (for instance through dplyr) you can add this type of printing using