You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often have to render monetary amounts in tables that span multiple orders of magnitude. It would be nice if there were a way to 'pretty print' these sanely, so e.g. 1357 would render as "$1.36 K", 5.5e7 renders as "$55 M", and so on. I've written one-off code that does it, but would prefer it live in some canonical package, like this one.
The text was updated successfully, but these errors were encountered:
Probably this has to be modified to deal with the `compact' argument, as well as different currencies. There is also the convention of wrapping negative amounts in parens, which could be useful.
Good catch wrt k vs K, I believe you are right. Perhaps the compact argument should determine whether there is a space between the $ and the number?
I am also guessing that some users would prefer that 1350 render as $1,350 instead of $1.35 k. Perhaps there should be some accommodation for that by setting the corresponding element of suffixes to NA. But maybe that's too fancy.
There's a Javascript library which does many of these conversions. You may want to look into their solutions for reference.
I often have to render monetary amounts in tables that span multiple orders of magnitude. It would be nice if there were a way to 'pretty print' these sanely, so e.g. 1357 would render as
"$1.36 K"
, 5.5e7 renders as"$55 M"
, and so on. I've written one-off code that does it, but would prefer it live in some canonical package, like this one.The text was updated successfully, but these errors were encountered: