Description Usage Arguments Value Examples
Source: https://github.com/fdryan/R/blob/master/ggplot2_formatter.r ——————————————————————————————— Formatting functions for ggplot graph axis ———————————————————————————————
1 | human_numbers(x = NULL, smbl = "", allpos = FALSE)
|
x |
a numeric vector to format |
smbl |
a symbol you'd like to prefix your numbers by |
allpos |
A logical value. If true, an absolute value will be returned |
a character vector the same length as the input vector
1 2 3 4 | # human_numbers(c(1000000 , 1500000, 10000000000))
# human_numbers(c(1.200000e+05, -2.154660e+05, 2.387790e+05, 4.343500e+04 ,5.648675e+12), "$")
# ggplot2 + scale_y_continuous(labels = human_numbers)
# ggplot2 + scale_x_continuous(labels = human_numbers)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.