# Using R in LaTeX with knitr and RStudio

February 28, 2013
By

(This article was first published on Statisfaction » R, and kindly contributed to R-bloggers)

Hi,

I presented today at INSEE R user group (FL$\tau$R) how to use knitr (Sweave evolution) for writing $\LaTeX$ documents which are self contained with respect to the source code: your data changed? No big deal, just compile your .Rnw file again and you are done with an updated version of your paper![Ctrl+Shift+I] is easy. Some benefits with respect to having two separate .R and .tex files: it is integrated in a single software (RStudio), you can call variables in your text with the \Sexpr{} command. The slow speed at compilation is no more a real matter as one can put “cache=TRUE” in code chunk options not to reevaluate unchanged chunks, which fastens things.

I share the (brief) slides below. They won’t help much those who already use knitr, but they give the first steps for those who would like to give it a try.