I used the makefile to automate the work of Sweave for my analysis reports in R, using the approach indicated by Jeromy Anglim with excellent success. Recently I heard about the cacheSweave package, and I would like to include this functionality in my Rnw file. I use the ProjectTemplate package to load all the necessary files at startup, and this takes some time because I have to pre-process the raw data files. The examples in the cacheSweave widgets show how to start Sweave using the cacheSweave driver in an R session:
library(cacheSweave) Sweave("foo.Rnw", driver = cacheSweaveDriver)
How to use cacheSweaveDriver in my command to run Sweave in batch mode? In my makefile, I call Sweave:
$(TEXFILE).tex: $(TEXFILE).Rnw R CMD SWeave $(TEXFILE).Rnw R CMD Stangle $(TEXFILE).Rnw
I am using Emacs + ESS to create a .Rnw file and run make. Here is the rest of my makefile for reference:
TEXFILE=report_presentation PLOTDIR= ../graphs PLOTS= FIGURES= $(PLOTDIR)/$(PLOTS) INPUTS= all: $(TEXFILE).pdf; make clean .PHONY: all clean $(TEXFILE).pdf: $(TEXFILE).tex $(FIGURES) $(INPUTS)
sheed03
source share