[R] problems with rounding in output
Dieter Menne
dieter.menne at menne-biomed.de
Tue Apr 11 15:48:54 CEST 2006
Brian Quinif <bquinif <at> gmail.com> writes:
>
> I used the round() function to round some estimates to 3 decimal
> places. I then sent put the rounded estimates in a matrix and used
> latex() to make a LaTeX table from them. However, in my table, there
> are estimtes which only have 2 decimal places. I assume that the third
> decimal place in these numbers was equal to zero, so the round()
> function simply cut off the superfluous zero. However, I want all of
> my estimates to have the same number of digits. Is there a way to
> force R to keep all three digits, even if the last one is zero?
latex implicitely calls format.df, which has documented cdec, rdec... arguments.
> However, after doing so, my LaTeX output had all of the digits that R
> output without rounding like it normally does. So, I tried using the
> round() command as described above. Another problem with my solution
> is that the negative signs in my LaTeX tables come out as hyphens, not
> the usual negative signs from math mode.
Try numeric.dollar = TRUE (but you might run in other problems with that
option, mainly in ctable).
Dieter
More information about the R-help
mailing list