Skip to main content
[ "article:topic", "showtoc:no", "jupyter:r" ]
Statistics LibreTexts

C.7: R and reporting

  • Page ID
    4325
  • Literal programming, the idea of famous Donald Knuth, is the way to interleave the code and explanatory comments. Resulted document is the living report: when you change your code or your data, it will be immediately reflected in the report. There many ways to create living reports in R using various office document formats but the most natural way is to use LaTeX. Let us create the text file and call it, for example, test_sweave.rnw:

    On the next step, this file should be “fed” to the R:

    Code \(\PageIndex{1}\) (Python):

    Sweave("test_sweave.rnw")
    

    After that, you will have the new LaTeX file, test_sweave.tex. Finally, with a help of pdfLaTeX you can obtain the PDF which is shown on the Figure C.8.1.