.. reproducible research tutorial file, created by ARichards ========================== Sweave example walkthrough ========================== The example file can be downloaded:: :download:`FishersExactTest.Rnw ` This first section is the preable to your LaTeX document. Do not forget to include the highlighted package in your Sweave document. .. literalinclude:: /../examples/FishersExactTest.Rnw :language: latex :emphasize-lines: 3 :lines: 1-5 The next block of the code simply begins the LaTeX document and specifies a section start in the standard way. .. literalinclude:: /../examples/FishersExactTest.Rnw :language: latex :lines: 7-12 Then we specify a table in LaTeX. Still there has been no mention of R or Sweave. .. literalinclude:: /../examples/FishersExactTest.Rnw :language: latex :lines: 13-23 Finally, we include our first bit of code in the documents. Notice that the R code is bookended by **<>=** and **@**. The variable *data* is a reference name for the code block. .. literalinclude:: /../examples/FishersExactTest.Rnw :language: latex :emphasize-lines: 1,6 :lines: 25-30 The last section is where we actually run the test and print the result. Again, the code is bookended in the same way and this time we label the code block *test*. .. literalinclude:: /../examples/FishersExactTest.Rnw :language: latex :lines: 32-38