[R] globally set digits=3 in Sweave
Liviu Andronic
landronimirc at gmail.com
Thu Aug 20 18:17:46 CEST 2009
On 8/20/09, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> Why not put
>
> <<echo=FALSE>>=
> options(digits=4)
> @
>
> somewhere near the top of your document?
>
I did so, but it has no practical effect on \Sexpr{} (which I'm
interested in, and failed to mention in the original e-mail).
With
<<echo=FALSE>>=
options(digits=4)
@
, the following
<<>>=
tmp <- pi
tmp
@
will yield
> tmp <- pi
> tmp
[1] 3.142
, while
\Sexpr{tmp}
will yield
3.14159265358979
and
\Sexpr{format(tmp)}
will yield
3.142
Liviu
More information about the R-help
mailing list