I'd like to use an R package that is not included in the default installation of the hosted version of Beaker, Beaker Lab. The code:
install.packages("raster")
fails with the message:
Error
Installing package into '/usr/local/lib/R/site-library'
Is there a way to install new libraries in Beaker Lab?
To install R packages:
1) Open scratch space, click BROWSE and create a directory rpackages
2) Create a blank R notebook
3) Type :
install.packages(‘packagename’, ‘/mnt/scratch/rpackages’, repos=’http://cran.us.r-project.org’)
and run the cell
4) Wait for installation to finish
5) If installation hangs for some time it means that something malfunctioned -> reload browser, close notebook, reopen notebook and redo the install command. This will continue from where it was before blocking.
To use installed packages:
In your R notebook, in the first cell (or cell before you use the package) type:
.libPaths(c(‘/mnt/scratch/rpackages’,.libPaths()))
And run the cell
Here's an example in Beaker Lab
https://lab.beakernotebook.com/approval/view/8645c600-3ec4-11e6-b811-8b63dac7dd4c