Rscript and Packrat

336 views
Skip to first unread message

mickn...@gmail.com

unread,
Sep 10, 2015, 8:25:30 AM9/10/15
to packrat-discuss
Hi,

I have noticed that when I run Rscript, it completely ignores packrat. Also if I explicitly run

Rscript .Rprofile

or

Rscript packrat/init.R

Is there are way to make packrat work with Rscript?

Thanks,
Michael

Kevin Ushey

unread,
Sep 10, 2015, 5:34:29 PM9/10/15
to packrat-discuss
Hi,

It looks to me that Rscript does indeed work with packrat; at least, I am seeing:

kevin:~/projects/testpackrat
$ Rscript -e ".libPaths()"
[1] "/Users/kevin/projects/testpackrat/packrat/lib/x86_64-apple-darwin13.4.0/3.2.1"
[2] "/Users/kevin/projects/testpackrat/packrat/lib-ext"
[3] "/Library/Frameworks/R.framework/Versions/3.2/Resources/library"

implying that packrat has successfully updated the library paths.

Can you provide any more information?

Thanks,
Kevin

mickn...@gmail.com

unread,
Sep 11, 2015, 2:30:26 AM9/11/15
to packrat-discuss
On Thursday, September 10, 2015 at 11:34:29 PM UTC+2, Kevin Ushey wrote:
 
kevin:~/projects/testpackrat
$ Rscript -e ".libPaths()"
[1] "/Users/kevin/projects/testpackrat/packrat/lib/x86_64-apple-darwin13.4.0/3.2.1"
[2] "/Users/kevin/projects/testpackrat/packrat/lib-ext"
[3] "/Library/Frameworks/R.framework/Versions/3.2/Resources/library"

Sorry, I should have been more specific. What I would really like is to not have the compiled packages but only the sources. What happens for me now, when I run R (not Rscript), is that the packages are automatically compiled from source to fit the current version of R. If you delete the lib folder, invoking Rscript does nothing.

Maybe I am taking the wrong approach. The problem I am trying to solve with packrat is the following:

I run a piece of software (GATK for analysis of DNA sequences) on a computer cluster with different versions of R available (for reproducibility). GATK uses Rscript a few times to generate some plots, and it requires certain R packages to do so. I would like for people to be able to run my pipeline without having to worry about installing specific versions of the packages.

However, Rscript is called as "Rscript (resource)org/broadinstitute/gatk/engine/recalibration/BQSR.R [input files]", and hence BQSR.R is in a folder not containing packrat. I would like something (an alias, maybe?) telling Rscript to always use a specific ratpack environment no matter where the R script resides. Is that possible?

Thanks,
Michael
Reply all
Reply to author
Forward
0 new messages