Reputation: 1
I have a question about the numeric value printing format with global options
My global option is as below.
options(digits = 5)
It works as ...
# type 1
> 123.1234
123.12
# type 2
>1234.1234
1234.1
I want it working like below by modifying global options.(without using round() function) please see below result
> 1234.1234
1234.12
Anybody can help me?
Upvotes: 0
Views: 123
Reputation: 1313
Use formatC(x,digits=2,format="f")
Output :
formatC(123.1234,digits=2,format="f")
[1] "123.12"
formatC(1234.1234,digits=2,format="f")
[1] "1234.12"
Upvotes: 2