[R] Numerical Format on axis

David Winsemius dwinsemius at comcast.net
Wed Nov 16 15:35:52 CET 2011


On Nov 16, 2011, at 7:41 AM, Mario Giesel wrote:

> Hello, list,
>
>  I'm new to R and I'm trying to produce a chart with currency values  
> on the y axis.
> Values should be e.g. 1,00, 1,50, 2,00, etc.
> In fact they are 1,0, 1,5, 2,0, etc.
> How do I get R to show two digits after the comma on that axis?

?sprintf
?format

On the left (geographic) side of the  Atlantic, it might be:

 > sprintf("%1.2f", 1)
[1] "1.00"

I assume that your system is set up with different options() and that  
your punkts are going to be handle to your liking by sprintf.

--

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list