conda - How to install R packages that are not available in "R-essentials"?
Now I have found the documentation:
This is the documentation that explains how to generate R packages that are only available in the CRAN repository: https://www.continuum.io/content/conda-data-science
Go to the section "Building a conda R package".
(Hint: As long as the R package is available under anaconda.org use this resource. See here: https://www.continuum.io/blog/developer/jupyter-and-conda-r)
alistaire's answer is another possibility to add R packages:
If you install packages from inside of R via the regular install.packages
(from CRAN mirrors), or devtools::install_github
(from GitHub), they work fine. @alistaire
How to do this: Open your (independent) R installation, then run the following command:
install.packages("png", "/home/user/anaconda3/lib/R/library")
to add new package to the correct R library used by Jupyter, otherwise the package will be installed in /home/user/R/i686-pc-linux-gnu-library/3.2/png/libs mentioned in .libPaths() .
To install other R Packages on Jupyter beyond R-essentials
install.packages('readr', repos='http://cran.us.r-project.org')
One issue is that the specific repository is the US.R-Project
(as below). I tried others and it did not work.
N.B. Replace readr
with any desired package name to install.
Here's a conda-centric answer. It builds on Frank's answer and the continuum website: https://www.continuum.io/content/conda-data-science with a bit more detail.
Some packages not available in r-essentials are still available on conda channels, in that case, it's simple:
conda config --add channels r
conda install r-readxl
If you need to build a package and install using conda:
conda skeleton cran r-xgboost
conda build r-xgboost
conda install --use-local r-xgboost
that last line is absent in the continuum website because they assume it gets published to anaconda repository first. Without it, nothing will be put in the envs/ directory and the package won't be accessible to commandline R or Jupyter.
On a mac, I found it important to install the Clang compiler for package builds:
conda install clangxx_oxs-64