library(tricky)

Parse numbers

parse_French_number(x = "1 123,123")
## [1] 1123.123

Format numbers

format_num formats numbers according to a locale (either French or English). format_num() is just a wrapper for the base-R format() function. Therefore, it is possible to use standard arguments of the format() functions such as scientifif = TRUE/FALSE.

format_num(x = 1233.123, locale = "fr")
## [1] "1 233,123"
format_num(x = 1233.123, locale = "en")
## [1] "1,233.123"
format_num(x = 1233.123, locale = "fr", scientific = TRUE)
## [1] "1,233123e+03"
format_num(x = 1233.123, locale = "en", scientific = TRUE)
## [1] "1.233123e+03"