If you want to export the output of an R script to latex and create a pdf document you can use the package Knitr with RStudio. But I guess this is only a good practise for short results.
What if I want to create a whole book, a 1000 pages thesis?
How do yo do the opposite?
I mean, Can I include R code within my latex files and run it directly from say TexStudio+LaTex/LuaTex? (In order to get the numerical results and graphics in the pdf).
NEW: Some people said one can use knitr to generate big docuemnts. Even if it's possible I think it's more comfortable and versatile to create LaTex documents from specific platform such as TexStudio.
So, what is the best practice?. Mixing both methods?: Generating parts of the document with Knitr and later mixing and modifying them with TexStudio?. How?
There are packages like lstlisting designed to show code properly but not to run it.