Wednesday, April 25, 2018

R Analysis Report with Sweave/Knitr + Emacs + AUCTEX


  1. In Emacs, compose a file "test.Rnw". 
  2. \documentclass{article}  
    \title{Test}
    \begin{document}  
    
    You can write inline expressions like $\pi=\Sexpr{pi}$.
    
    Here is a code chunk.
    <<a>>=
    x <- rnorm(100)
    summary(x)
    plot(x)
    @ 
    
    \end{document}
    
  3. Enter command for knitting: "M-n r" (Noweb => Sweaving/Tangling => Knit)
  4. Enter command for generating PDF report: "M-n P". 

No comments:

Post a Comment