0

If I write in the R console

> 1.000000000000000123456 - 1

I get:

[1] 2.220446e-16

If I type this in an .Rnw file, knitr gives the following output in the PDF:

1 - 1

with result

0

How do I get knitr to reproduce the console in a particular block of code (preferably with the output not in scientific notation)?

mk9y
  • 320
  • 2
  • 11
  • I'm not sure I get the question, but have you tried `\`r 1.000000000000000123456 - 1\``? – Maël Sep 02 '22 at 12:26
  • this works for me in a .Rmd file: ` ```{r echo=TRUE} 1.000000000000000123456 - 1 ``` ` – Julian Sep 02 '22 at 12:32
  • My code in the .Rnw file is ```<>= 1.000000000000000123456 - 1 @ ``` Which corresponds to what @Maël and @Julian suggested – mk9y Sep 02 '22 at 12:48

0 Answers0