More efficient R / Sweave / TeXShop work-flow?

后端 未结 11 927
傲寒
傲寒 2021-01-30 05:28

I\'ve now got everything to work properly on my Mac OS X 10.6 machine so that I can create decent looking LaTeX documents with Sweave that include snippets of R code, output, an

11条回答
  •  孤城傲影
    2021-01-30 06:23

    I use either Aquamacs or Eclipse to do the editing of the .Rnw file, then I use the following shell function to compile & view it:

    sweaveCache () {
      Rscript -e "library(cacheSweave); setCacheDir(getwd()); 
        Sweave('$1.Rnw', driver = cacheSweaveDriver)" && 
      pdflatex --shell-escape $1.tex && 
      open $1.pdf
    }
    

    Notice that I'm using the cacheSweave driver, which helps avoid constantly re-executing code sections that take a long time to run.

    BTW, I'm also trying to switch over to Babel instead of Sweave; not sure which I'll end up using more often, but there are definitely aspects of Babel that I like.

提交回复
热议问题