Skip to contents

Label functions for ggplot2 scales (or for any vector of numbers) that follow the current language setting (see gtl_opt_set_i18n()): an apostrophe between thousands in every language (60'000), a decimal comma in French and German (2,5) and a space before the percent sign in French and German (2,5 %). The language is read when the numbers are formatted.

Usage

gtl_label_number(...)

gtl_label_percent(...)

Arguments

...

Arguments passed on to scales::number() or scales::percent() (accuracy, scale, suffix...)

Value

A function that formats numbers

Examples

gtl_opt_set_i18n("fr_CH")
gtl_label_number()(c(60000, 2.5))
#> [1] "60'000" "2"     
gtl_label_percent(accuracy = 0.1)(0.025)
#> [1] "2,5 %"

gtl_opt_set_i18n("en_US")
gtl_label_number()(c(60000, 2.5))
#> [1] "60'000" "2"     
gtl_label_percent(accuracy = 0.1)(0.025)
#> [1] "2.5%"