The optimal way to do sweave may be to have a master file in LaTeX, and a separate Rnw file contains all the computations, figures, and tables. That way, it is easy to compile the LaTeX as the writing goes on without the hassle of carrying out the computations (especially when some of them are heavy) every time.
When the computations are finished, one can simply include the generated LaTeX output in the master LaTeX file to get the complete manuscript. Here are the files:
- master.tex: the master LaTeX file that contains text materials of a paper;
- tables.Rnw: the sweave file for creating all the tables;
- tables.tex: the LaTeX output file that can be included in the master file;
- figure.Rnw: the sweave file for creating all the figures;
- figure.tex: the LaTeX output file that can be included in the master file;
- driver.tex: a simple LaTeX driver to view the tables and figures before including them into the master LaTeX file.