[R] Rgui maintains open file handles after Sweave error

Yihui Xie xie at yihui.name
Thu Apr 5 20:22:48 CEST 2012


Things are not that gory with knitr. You only need to use the option
cache=TRUE and it will take care of most of the things you mentioned.
For example, objects in a chunk are automatically saved and lazy
loaded; when code is modified, old cache will be automatically removed
and new cache will be built.

You can take a look at the Cache section in the manual:
https://github.com/downloads/yihui/knitr/knitr-manual.pdf And more
explanations for using cache safely here:
http://yihui.name/knitr/demo/cache/

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, Apr 5, 2012 at 12:47 PM, Alexander Shenkin <ashenkin at ufl.edu> wrote:
> Reproducibility is important, and as I mentioned in a previous email,
> there are probably ways I could avoid running the entire script over and
> over again with each sweave compilation.  Still, relying on saved
> workspaces, temporary files or caches still has some of the issues that
> working in the main environment does.  Specifically, you're not working
> with the base data all the way through the final analyses each time you
> run the sweave doc.  To produce those workspace, files or caches
> requires a run of scripts.  If those scripts have changed, or if your
> data have changed, then your workspace, files and/or cache is then just
> as out of date as your workspace.  Saving workspaces, files and/or
> caches still requires care that they're not saved after having been
> modified by the command line, etc.  I think that working with saved
> workspaces, files and/or caches is probably less prone to "pollution"
> than working in the main environment, but it's far from failsafe.
>
> As long as the final sweave doc is run with scripts from beginning to
> end, getting the sweave doc up to snuff by working more quickly in the
> main environment is acceptable IMHO.  So is working with the other
> methods above.
>
> Best,
> Allie
>



More information about the R-help mailing list