[R] Number of digits to display?

Jorge I Velez jorgeivanvelez at gmail.com
Mon Oct 26 20:27:08 CET 2015


Dear Judson,

Perhaps the following example would give you some ideas:

R> options(digits = 4)
R> rnorm(5)
#[1] -0.57089 -0.14759  0.05717 -0.04935  2.22123
R> options(digits = 3)
R> rnorm(5)
#[1]  0.789  0.616  0.156 -1.315 -1.090
R> options(digits = 2)
R> rnorm(5)
#[1] -1.04 -0.58 -0.50  0.30  0.60

​Best regards,
Jorge.-


On Mon, Oct 26, 2015 at 11:43 AM, Judson <judsonblake at msn.com> wrote:

> How do I control the number of digits to display,
> say, in a matrix, without rounding or losing accuracy
> in subsequent calculations?
> round() of course reduces accuracy.
>
> Also, if all my results
> are really fractions, is there a way to display
> them as fractions of integers rather than
> decimal expressions?
>
> ................... judson blake
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list