Recently for a project I’ve had the need to produce a little example of using a “stack” of programmes to produce a pdf document, in this case a scientific manuscript for submission to a scientific journal. To do this I started with the R editor/working environment called RStudio. I actually prefer to use emacs as my editor but RStudio is much easier for people attempting to learn R.
I’ve uploaded a group of files to a github repository called presentation where you can download them if you want. Most people will have to install some extra R packages to make all of this work, and there are extra files in this directory that were supplied by the journal Science. They are required to make the Latex part work. The central file that drives it all is the .rnw file, which is the one you need to call up into RStudio, and then compile it. If you have the correct libraries you should end up with a nice example manuscript, for Science journal. I hope it helps as a very simple primary example.
J