dfe-analytical-services / dfeR

Common R tasks in the Department for Education (DfE)
https://dfe-analytical-services.github.io/dfeR/
GNU General Public License v3.0
8 stars 2 forks source link

Add comma separate function #64

Closed cjrace closed 3 months ago

cjrace commented 5 months ago

Is your feature request related to a problem? Please describe.

Add a comma_separate() function to present large numbers neatly. This will be used by format_readable(), but also more widely available as it's used frequently in our projects.

Describe the solution you'd like

A function based on this:

comma_separate <- function(x) {
  format(x, big.mark = ",", trim = TRUE)
}

It's basic, but given how much we use this in our projects it'll help to tidy up the code and make it more readable.

Describe alternatives you've considered

None

Additional context

None