Strange problem with comma function


Had strange issue with comma function to insert comma separate for thousands etc. For some random columns it adds a .0 at the end which still happens to integers, persists when I use digits = 0 as well.

There is no base::comma function, are you referring to a function from some package ?

Sorry its In scales package

Can you please provide an example of such a column as presents you thr issue?
Here is a guide to assist you in how to do so.
FAQ: How to do a minimal reproducible example ( reprex ) for beginners

Try passing the argument accuracy = 1 to scales::comma
Here's the relevant help text from ?comma - this might help explain why it will by default sometimes add extra numbers after the decimal point:

accuracy A number to round to. Use (e.g.) 0.01 to show 2 decimal places of precision. If NULL, the default, uses a heuristic that should ensure breaks have the minimum number of digits needed to show the difference between adjacent values.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.