human_numbers: Human Numbers: Format numbers so they're legible for humans...

Description Usage Arguments Value Examples

Description

Source: https://github.com/fdryan/R/blob/master/ggplot2_formatter.r ——————————————————————————————— Formatting functions for ggplot graph axis ———————————————————————————————

Usage

1
human_numbers(x = NULL, smbl = "", allpos = FALSE)

Arguments

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

Value

a character vector the same length as the input vector

Examples

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)

cardiomoon/moonBook2 documentation built on May 13, 2019, 12:40 p.m.