Sweave really you need only two steps for a simple document as this
From the command line is enough:
R CMD Sweave my_sweave_file.Rnw
Or even only one:
R CMD Sweave --pdf my_sweave_file.Rnw
In case that you have cross-references (
\cite commands, table of contents, index, glossaries, etc.) this will not enough, so you must also compile the generated
.tex file with the appropriate tools and rerun
pdlatex as needed. See Tools for automating document compilation if you have some problem with the compilation sequences.
knitr a simple compilation could de done with:
Rscript -e "library(knitr); knit('my_sweave_file.Rnw')"
Obviously, in complex Latex documents, you will need add some compilation steps as above.
Another easy way is work with LyX instead of LaTeX directly, loading the
knitr module, making automatically the "R Noweb" (
.Rnw) to LaTeX exportation and all the compilation steps of the LaTeX file.