Skip to content
R for the Rest of Us Logo

How to Use the Scales Package in R for European-style Number Formatting

Hello, my European friends! Ever read the number 123.45 (formatted in the American style where the period is the decimal point) and wish you could easily convert this to a European-style 123,45 (where the comma is the decimal point). You can! In this R in 2 Minutes video, I show you how to use the scales package in R for European-style number formatting.

Code shown in video

library(scales)

comma(
  x = 123.45,
  accuracy = 0.01
)

comma(
  x = 123.45,
  accuracy = 0.01,
  big.mark = ".",
  decimal.mark = ","
)

Sign up for the newsletter

Get blog posts like this delivered straight to your inbox.

Let us know what you think by adding a comment below.

You need to be signed-in to comment on this post. Login.

David Keyes
By David Keyes
April 3, 2024

Sign up for the newsletter

R tips and tricks straight to your inbox.