[R] Problem with large/small numbers in knitr

Yihui Xie xie at yihui.name
Fri Dec 28 07:38:02 CET 2012

(The same question was cross-posted in the knitr mailing list, so cc'ed as well)

According to the other email from Steven, this problem was solved by
reinstalling R. I cannot reproduce the problem under either Ubuntu or
Windows (regardless of 32-bit or 64-bit R), so I have no idea of what
happened. All I can suggest in this case is to update R and run
update.packages() as indicated by FAQ1:

Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

On Wed, Dec 26, 2012 at 6:28 PM, xiaodao <yanghaowang at utk.edu> wrote:
> I have problems with very large numbers using knitr. In the following, my a
> and b are extremely small and ssrr and ssru are extremely large. Knitr
> delivers error messages. Scaling ssrr and ssru by 1000 resolved the problem:
> ssrr <-ssrr/1000 ;  ssru<-ssru/1000
> Any clue as to how I might resolve the problem?
> BTW, the same program does run in another computer. I am wondering whether
> my installation of Scientific Work place interferes, and if so, what else I
> might do to avoid the problem.
> \documentclass{article}
> \begin{document}
> <<setup, echo=FALSE, cache=FALSE>>=
> ## numbers >= 10^5 will be denoted in scientific notation,
> ## and rounded to 2 digits
> options(scipen = 1, digits = 2)
> <<>>=
> a<-1e-13
> b<-2.5e-10
> ssrr<-123456.12
> ssru<-123400.00
> @
> $
> c=\Sexpr{a}/\Sexpr{b} % either this formula or the following formula will
> has error message "missing $" after click "complie" in Rstudio.
> f=\Sexpr{ssrr-ssru}/\Sexpr{ssru}
> $
> \end{document}
> --
> View this message in context: http://r.789695.n4.nabble.com/Problem-with-large-small-numbers-in-knitr-tp4653986.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at 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.

More information about the R-help mailing list