[R] pgfSweave doesn't lazyload my objects

Yihui Xie xie at yihui.name
Thu Feb 2 22:16:00 CET 2012


I can reproduce it but I do not know why this happens.

FWIW, I tried the knitr package and it worked well except that you
have to write cache=TRUE or FALSE instead of true/false.

library(knitr)
knit('test_pgf.Rnw')

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Thu, Feb 2, 2012 at 6:12 AM, Ludo Pagie <lpagie at xs4all.nl> wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list