Thursday, September 29, 2011

Sweave

I used Sweave a while ago. It seems to be useful when preparing answer keys for my class. I stopped using it because I didn't know how to control the figure size (as in pdf(..., width=4)).  (I now know that I can use the width= and height options in Sweave.  But for some reason, the output is not exactly what I wanted.)

I picked it up again today so that I can document a consulting project without handing out two files.  When I used Sweave last time, I used it on a Mac. Today, I use a PC with texlive. When compiling the resulting .tex file, the message "Sweave.sty not found" appeared. After a few moment, I realized that the default for "stylepath" in R is now FALSE. But when switching it back to TRUE, the path in the resulting .tex file is

\usepackage{c:/PROGRA~1/R/R-213~1.1/share/texmf/tex/latex/Sweave}

which is not recognized by tex or latex as a proper path. Initially, I copied the folder to a different place (e.g., c:/texlive/Sweave) and changed the path in the resulting .tex file. But a better way is probably to reinstall R in a folder that does not have space in its name, so that I don't have to modify the generated .tex file every time the .Rnw file is updated. By moving R (e.g. to C:/R-2.13.1), the "site-start.el" file needs to be modified so that Emacs-ESS can find R.

No comments:

Log or not log

LOGorNOTLOG.html Log or not log, that is the question May 19, 2018 In 2014 I taught a special topics class on statistical i...