[R] globally set digits=3 in Sweave

Duncan Murdoch murdoch at stats.uwo.ca
Thu Aug 20 17:24:01 CEST 2009


On 8/20/2009 6:19 AM, Liviu Andronic wrote:
> Dear all
> I would like to globally set
> options(digits = 4)
> 
> in an Sweave document. I've read this thread [1] where it was
> suggested to set the above option and pass every printed number
> through format(). Aanother way to do so would be to round(expr, 4).
> However I would like to set the digits option once per document so
> that every number printed respects it, without the need to pass every
> time through a formatting/rounding function. Is this possible in
> Sweave?

Why not put

<<echo=FALSE>>=
options(digits=4)
@

somewhere near the top of your document?

Duncan Murdoch

> 
> Thank you
> Liviu
> [1] https://stat.ethz.ch/pipermail/r-help/2003-September/039481.html
> 
> 
> 
> 
>




More information about the R-help mailing list