The following attached files are to help you start to learn and use both Sweave and Latex:

Some Helpful Tips:
  • You need to add a blank line (with no extra spaces) after the
     '\end{document}' 
    expression if you get the following error from Sweave:
Warning message:
incomplete final line found by readLines on `blah.nw'
  • Commenting in your .nw file:
    • Use the Latex comment % to comment out lines of text and whole R code chunks (from the <<>>= to the @).
    • Use the R comment # to comment out lines of R code within an R code chunk (between the <<>>= to the @).
  • To setup Sweave to run outside of R (i.e., from a konsole command prompt):
    • Open a Konsole window.
    • Change to the ~/bin (i.e., /home/scottt/bin) directory: cd ~\bin
    • List the ~/bin directory to see if a Sweave shell script is already present: ls
    • If Sweave is listed in the contents of the directory, open Sweave in a text editor (here I use pico): pico Sweave
      1. If Sweave is not present, open a new file to be named Sweave in a text editor (again using pico): pico Sweave
    • If Sweave was already present, make sure the opened file contains the following two lines (make sure it matches exactly). If Sweave was not present, type the following lines in the text editor:
#!/bin/sh
echo "library(tools) ; Sweave(\"$1.nw\")" | R --no-save --no-restore
    • Exit pico by typing Ctrl+X to save the Sweave file (answer Yes to saving changes, and keep the name of the file as Sweave).
    • At the command prompt type the following to initiate Sweave as a shell script: chmod +x
    • Change your 'path' to include the ~/bin directory.
      • Change to your 'home' directory: cd ~
      • Open your .bashrc (a hidden file) in a text editor: pico .bashrc
      • In the text editor, type a new line at the end of the file: export PATH=$PATH:~/bin
      • Exit pico by typing Ctrl+X to save your .bashrc file (answer Yes to saving changes, and keep the name of the file as .bashrc).
  • If you have any questions, see Dale, Jeff, Cole, Jeremy, or Thomas.
Edit | Attach | Print version | History: r32 | r5 < r4 < r3 < r2 | Backlinks | View wiki text | Edit WikiText | More topic actions...
Topic revision: r4 - 27 Apr 2006, TheresaScott
 

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback