numbers2prefix | R Documentation |
Using SI unit prefixes is a more compact way to write very large or very small numbers which can sometimes be useful. This function takes a number (or a vector of numbers) and returns the equivalent value expressed using the nearest prefix. My thanks to https://stackoverflow.com/users/843265/tomelgin for posting the code that this function was based on (see first link below).
numbers2prefix(number, rounding = FALSE, digits = ifelse(rounding, NA, 6))
number |
number, numeric vector |
rounding |
rounds number to nearest integer (default FALSE), boolean |
digits |
if rounding=FALSE, lets you specify significant figures (default 6), numeric |
number followed by SI prefix (as character string, separated by narrow no-break space)
https://stackoverflow.com/questions/11340444/convert-numbers-to-si-prefix
https://stackoverflow.com/questions/28159936/format-numbers-with-million-m-and-billion-b-suffixes
https://www.nist.gov/pml/owm/metric-si-prefixes
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.