...
- http://en.wikibooks.org/wiki/LaTeX
- http://latex.tugraz.at/latex/tutorial
- http://www.latex-tutorial.com/tutorials/
You can of course copy-paste your R code in LaTeX (using e.g. the package listings for syntax formatting) and save graphics to include, but here the advantage is:
This enables the creation of dynamic reports that are updated automatically if data or analysis changes.
This means Sweave is very useful for "on going" projects, where things are expected to change, as well as quick notes on something you are working on.
Ref:
https://support.rstudio.com/hc/en-us/articles/200552056-Using-Sweave-and-knitr
LaTex in RStudio
First, install the knitr package:
> install.packages("knitr")
Set knitr as default for Rnw files: https://support.rstudio.com/hc/en-us/articles/200532247
Open a new file of type "R Sweave", it will automatically contain:
...
save the file (the authomatic file extension will be .Rnw) and try to compile the file ("Compile PDF" button). You should be prompted a PDF: congratulations, this is your first LaTeX file!
Sweave and knitr
You can of course copy-paste your code in LaTeX (using e.g. the package listings for syntax formatting) and save graphics to include, but here the advantage is:
This enables the creation of dynamic reports that are updated automatically if data or analysis changes.
This means Sweave is very useful for "on going" projects, where things are expected to change, as well as quick notes on something you are working on.
Ref:
https://support.rstudio.com/hc/en-us/articles/200552056-Using-Sweave-and-knitr
Setting knitr as default for Rnw files
Ref:
Sweave manual
http://www.statistik.lmu.de/~leisch/Sweave/Sweave-manual.pdf
https://support.rstudio.com/hc/en-us/articles/200532247
Links
Coming soon