-- JoAnnAlvarez - 27 Aug 2010

Weaver!

weaver can save results that take a long time to run, so that you can save time while you edit other R code chunks or latex code. Weaver knows when you edit code within something you've set to cache, and runs that part of code again when necessary.

Install the weaver package on your linux machine:

It's not on CRAN. You can download it from bioconductor. If you're using linux, you want the source file. Save the .tar file in the directory with your other R packages. Make sure you already have the digest package installed. Go to the terminal and go to the directory. Run sudo R CMD INSTALL packagename.tar.gz

Seth Falcon's How to use weaver

Start caching!

Within your .nw file, for any R code chunks that you want to cache, use the cache=true Sweave option:
<<cache=true>>=

Load the weaver library.

library(weaver)

Then, when you Sweave the .nw file, use the driver = weaver() option of the Sweave function:

Sweave( _filename.nw_, driver = weaver())

Notes

  • If you kill a Sweave() call when the weaver library is loaded, for the rest of your R session, R will not return any results to the terminal. You can fix this by running sink() after the kill.
  • Don't trust weaver to figure out the dependencies in your chunk. It can only detect changes in variables that are in a specific chunk when the change occurs in a previous chunk that has cache=true.
  • Don't include any printing or plotting within a chunk with cache=true.
Topic revision: r3 - 14 Sep 2011, JoAnnAlvarez
 

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