Hi Elizabeth,

Try using sprintf (?sprintf) instead of round().

HTH,
Jorge


On Sat, Jan 30, 2010 at 5:50 PM, Elizabeth Stanny <> wrote:

> Hi,
>
> I want 3 digits printed even if the last one is zero with \Sexpr{}
>
> For example:
> > ghg.06[12]
> [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
> epsta...@gmail.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to