dfe-analytical-services / dfe-analytical-services/dfeR
Enhance the `gbp = TRUE` option in `pretty_num()`
- Dominant language
- R
- Stars
- 14
- Forks
- 4
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 3
Description
## Is your feature request related to a problem? Please describe.
When using the `gbp = TRUE` option in `dfeR::pretty_num()` it would be amazing if it was "clever" and formatted the value in a usual human-readable manner.
## Describe the solution you'd like
What I really mean by this above is, when the value is a whole number, providing no decimal places - so 10 appears as £10, but when the value is not a whole number, providing 2 decimal places - so 10.1 appears as £10.10 or 10.12567 as £10.13.
## Describe alternatives you've considered
You can kind of do this by setting `dp = 2` and `nsmall = 0` but this does not work for the a value with one decimal place - s0 10.1 appears as £10.1 instead of the desired £10.10.
I am aware there are a few other bits of decimal place/ abbreviation functionality developed and being developed, so it will need to carefully interact with those too, which is what may make this a little more complex.
For example, if you have `abbreviate = TRUE` and `gbp = TRUE` you will want numbers to appear as £10.10 for 10.1 and £1 million for 1,00,000. Then there is a the added complexity of what if I want to control the dp for the abbreviated numbers, such as `dp = 3` so that 1,234,500 appears as £1.235 million but 10.1 still appears as £10.10 and not £10.100.
You could set a hard rule that if you have `gbp = TRUE` decimal places will be **strictly** set to 2 even for abbreviated values (unless a whole number). Or... you have a separate abbreviated values decimal place (but this feels like it may be getting quite overengineered).
As always, open to discussion on this and happy to answer questions or help out. 😄
Contributor guide
Assessment
This issue has not been assessed yet.