[R] Number of digits to display?
Marc Schwartz
marc_schwartz at me.com
Mon Oct 26 20:39:59 CET 2015
> On 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
Hi,
You need to differentiate between the way in which R *stores* numeric values and the way in which it *displays* numeric values.
If you want to affect the display of values in routine output, see ?options and note 'digits' and 'scipen'.
Also see ?print.default.
Those approaches do not affect the precision of calculations on the *stored* values.
For fractions, see:
require(MASS)
?fractions
Regards,
Marc Schwartz
More information about the R-help
mailing list