[R] pgfSweave doesn't lazyload my objects

Ludo Pagie lpagie at xs4all.nl
Thu Feb 2 13:12:06 CET 2012


Hi all,

I'm struggling a bit to get pgfSweave to lazyload objects when compiling 
a .Rnw file for a second time. Caching works fine except that for every 
run all objects get cached again and again. I've used cacheSweave which 
works fine; all cached objects from code-chunks with option cache = TRUE 
are lazy loaded. I've tried it on two machines ... I'm pretty sure I'm 
overlooking something obvious.

Below is my .Rnw and sessionInfo. Pointers, suggestions, etc are most 
welcome.

%%%%%%%%%%%%%%% RNW; test_png.Rnw %%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}

\begin{document}

some bla bla text

<<large-chunk-no-cache, cache=false>>=
mm1 <- matrix(1:1e7, 1e3, 1e4)
@

<<c2>>=
print(length(mm1))
@

<<large-chunk-do-cache, cache=true>>=
mm2 <- matrix(1:1e7, 1e3, 1e4)
@

<<c4>>=
print(length(mm2))
@

\end{document}

%%%%%%%%%%%%%%%%% END RNW %%%%%%%%%%%%%%%%%%

I am running the folowing R command:

pgfSweave('test_pgf.Rnw', compile.tex=F)

########### SESSION INFO ################

R version 2.14.0 (2011-10-31)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
  [1] pgfSweave_1.2.1  tikzDevice_0.6.2 cacheSweave_0.6  formatR_0.3-4
  [5] optparse_0.9.4   getopt_1.17      highlight_0.3.1  parser_0.0-14
  [9] Rcpp_0.9.9       codetools_0.2-8  stashR_0.3-4     filehash_2.2

loaded via a namespace (and not attached):
[1] digest_0.5.1 grid_2.14.0



More information about the R-help mailing list