Save, but do not expand/unzip, the tar file to a directory. In the example below 'code_folder' refers to a folder within the tar.gz file that contains R. The readme file tells users about requirements (R, R studio, packrat, R package development prerequisites (Rtools for Windows, XCode for Mac)), and includes output of sessionInfo() to document R package versions that the R code should use after instructions are followed. The readme file includes instructions similar to those below, and so far users have been able to run R code using the package dependencies. The packrat library, and the unbundle command for the tar.gz file) unbundle.R (R code file that includes a library statement to load I have provided users with three files: -tar.gz (packrat bundle file) So, can someone please provide clear step-by-step instructions for how users of a bundled snapshot should unbundle, and then use that saved snapshot to run a R code file?Īfter some experimenting, I found an approach that seems to have worked so far. The packrat page ( ) and CRAN provide very little documentation about unbundling to help troubleshoot this, or that I could point users of my code to for instructions (who likely will be familiar with R, but may not have used packrat). It seems like init() should not be necessary because I am not trying to create a new snapshot, but rather utilize the one in the bundle. But subsequently calling packrat::restore() gave me the error "This project has not yet been packified. I then called packrat::unbundle(bundle = "directory", where = "directory"), which unbundled successfully. I opened an R code file in R studio, and called library(packrat) to load packrat (also v 0.4.8-1). I tested unbundling using a different computer from the one I used to write R code and create the bundle. I want to provide the R code and packrat bundle to others to make the work I am doing (including the R environment) fully reproducible. I used packrat (v 0.4.8.-1) to to create a snapshot and bundle of the R package dependencies that go along with the corresponding R code.
0 Comments
Leave a Reply. |