Skip to content

Sweave - have Sexpr print 3 digits when the last is 0

2 messages · Elizabeth Stanny, Jorge Ivan Velez

#
Hi,

I want 3 digits printed even if the last one is zero with \Sexpr{}

For example:
[1] 0.2501008

I want: 0.250 

What I've tried:
\Sexpr{round(ghg.06[12],3)}
0.25

\Sexpr{format(ghg.06[12])} % set options(digits=3) in earlier rnw chunk
0.25

\Sexpr{round(ghg.06[12],4} %but I want 3 not 4 digits
0.2501

Thanks in advance.

Elizabeth Stanny
epstanny at gmail.com