[Rd] add sessionInfo() option to "save"

Yihui Xie xie at yihui.name
Fri May 4 19:02:54 CEST 2012


My 2 cents in the last section of this page: http://yihui.name/knitr/demo/cache/

You can set something like opts_knit$set(cache.extra =
sapply(c('boot', 'ggplot2', 'splines'), packageVersion)) so that each
time these packages are updated, the cache of your document will be
rebuilt.

That is not exactly the same as what you mentioned, however, with the
knitr package, you can easily leave a chunk like this in your Rnw
document:

<<sessioninfo, cache=TRUE, include=FALSE>>=
.sessioninfo = sessionInfo()
@

and the variable .sesioninfo will be saved to the cache database,
which you can load into your R session by lazyLoad() and examine it. I
think it might be better than manually save() objects.

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 Fri, May 4, 2012 at 11:09 AM, Robert M. Flight <rflight79 at gmail.com> wrote:
> Hi All,
>
> I was wondering if there would be any interest in adding an option to the
> "save" function in R that I think would be useful. I was thinking that it
> might be useful to have an option that would generate a ".sessionInfo"
> variable that contains the output of "sessionInfo()", and adds it to the
> list of objects to be saved. This way, whenever an RData object is loaded,
> all the information about the R version, and attached packages present
> would be available for query.
>
> I know I have been bitten by the problem of generating results using
> different versions of packages and different versions of R. I know that
> this is partly the idea behind Sweave (and other report generation
> measures), and perhaps I am at fault for not keeping better track of these
> types of things, but this seems like it would be useful to a lot of other
> people besides just me.
>
> Thoughts?
>
> -Robert
>
> Robert M. Flight, Ph.D.
> University of Louisville Bioinformatics Laboratory
> University of Louisville
> Louisville, KY
>
> PH 502-852-1809 (HSC)
> PH 502-852-0467 (Belknap)
> EM robert.flight at louisville.edu
> EM rflight79 at gmail.com
> robertmflight.blogspot.com
> bioinformatics.louisville.edu/lab
> github.com/rmflight/general/wiki
>
> The most exciting phrase to hear in science, the one that heralds new
> discoveries, is not "Eureka!" (I found it!) but "That's funny ..." - Isaac
> Asimov
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list