Setting up Sweave, R, Latex, Eclipse StatET A few days ago I saw a post on how to setup a SweaveR, which would allow for a user to directly export things like tables, graphs, etc. into Latex. I couldn't quite follow the directions. 
Can anyone give step-by-step  instructions on how to do it on both, Mac and Windows?
 A: I use Eclipse / StatEt to produce document with Sweave and LaTex, and find Eclipse perfect as an editing environment. I can recommend the following guides:


*

*Longhow Lam's pdf guide

*Jeromy Anglim's post (Note this includes info on installing the RJ package required for the latest versions of StatEt.)


I also use MikTex on Windows and find everything works really well once it's setup.  There's a few good questions and answers on Stack Overflow as well.
A: For me, I found that Eclipse was overkill for creation of scientific papers. 
So, for Windows, what i did was the following:
Install Miktex 2.8 (? not sure of version). Make sure that you install Miktex into a directory such as C:\Miktex, as Latex hates file paths with spaces in them. Make sure to select the option to install packages on the fly. 
Also make sure that R is installed somewhere that Latex can find it i.e. in a path with no spaces.
I installed TechNix center as my program to write documents in, but there are many others such as WinEdt, eclipse, texmaker, or indeed Emacs. 
Now, make sure that you have \usepackage{Sweave} and usepackage{graphicx} in your preamble. 
As I'm sure you know, you need to put <>= at the start of your R chunk, and end it with @.
You will need either the package xtable or Hmisc to convert R objects to a latex format.
I like xtable, but you will probably need to do quite a bit of juggling of objects to get it into a form that xtable will accept (lm outputs, data frames, matrices). 
When inserting a table make sure to put the results=tex option into your preamble for the code chunk, and if you need a figure, ensure that the fig=TRUE option is also there. 
You can also only generate one figure per chunk, so just bear that in mind. 
Something to be very careful with is that the R code is at the extreme left of the page, as if it is enclosed in an environment then it will be ignored (this took me a long time to figure out). 
You need to save the file as .Rnw - make sure that whatever tex program you use does not append a .tex after this, as this will cause problems. 
Then either run R CMD Sweave foo.Rnw from the command line, or from within R run Sweave("foo.Rnw"). Inevitably it will fail at some point (especially if you haven't done this before) so just debug your .Rnw file, rinse and repeat. 
If it is the first time you have done this, it may prove easier to code all the R analyses from within r, and then use print statements to insert them into LaTex. I wouldn't recommend this as a good idea though, as if you discover that your datafile has errors at the end of this procedure (as i did last weekend) then you will need to rerun all of your analyses, which if you could properly from within latex from the beginning, can be avoided. 
Also, Sweave computations can take some time, so you may wish to use the R package cacheSweave to save rerunning analyses. Apparently the R package highlight allows for colour coding of R code in documents, but i have not used this. 
I've never used latex or R on a Mac, so i will leave that explanation to someone else. Hope this helps.
A: RStudio (rstudio.org) makes things quite easy assuming LaTeX is already installed on your system.  There is a PDF button that runs the code through Sweave then runs it through pdflatex and launches a pdf viewer.
A: I installed this suite quite recently and followed the instructions as per instructions here.
There are links to all required software components required. I use MiKTex for all LaTex components.
There are a few pitfalls if you are planning to use 64-bit windows as you will need the additional 64-bit java runtime. This is quite easy to overcome if you go to java.com in a 64-bit IE and verify your installation, it will point you to the 64-bit installer which is otherwise difficult to find.
To avoid mucking around with path variables I simply extracted the eclipse folder in C:\Program Files as this is where java lives and 64-bit R. From here the configuration options in eclipse can easily run automatically and find the appropriate parameters.
I hope this helps.
