Native R package support
This chapter describes the specifics of working with public and private R packages repositories.
- Environment tool
Use the tool (Environment > Packages) to install and manage R packages (
install.packages
,remove.packages
, andavailable.packages
commands supported).This method records the applied changes to the environment.yml file of the respective notebook. As a result, the new configuration is automatically applied when opening the notebook.
- .Rprofile files
To configure a custom R package repository, add an .Rprofile file to the notebook's Attached data or the home directory in a custom agent image (applicable for Datalore Enterprise).
If you want to use R Studio Package Manager you can set it up it there (or in other supported places if you use a custom docker image). If no CRAN url is specified, https://cloud.r-project.org is used by default.
The .Rprofile file will be respected when installing environment for the notebook.
- Custom R environment without Anaconda (for Datalore Enterprise users)
This custom environment sets a non-conda default environment with the R kernel.
FROM jetbrains/datalore-agent:2023.5 ENV CUSTOM_ENV_NAME myenv USER root RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends libzmq3-dev libcurl4-openssl-dev libssl-dev r-base make g++ libharfbuzz-dev libfribidi-dev libtiff-dev apt-file && \ Rscript -e "install.packages(c('repr', 'IRdisplay', 'IRkernel'), type = 'source')" && \ rm -rf /var/lib/apt/lists/* && apt-get clean RUN sudo chown -R datalore:datalore /home/datalore USER datalore RUN mkdir -p /opt/anaconda3/envs/$CUSTOM_ENV_NAME RUN /opt/python/bin/python -m venv /opt/anaconda3/envs/$CUSTOM_ENV_NAME RUN /opt/anaconda3/envs/$CUSTOM_ENV_NAME/bin/pip install ipykernel==5.5.3 ipython==7.31.1 ipython_genutils==0.2.0 jedi==0.17.2 RUN PATH=/opt/anaconda3/envs/$CUSTOM_ENV_NAME/bin/:$PATH Rscript -e "IRkernel::installspec(sys_prefix=TRUE)" RUN /opt/datalore/build_code_insight_data.sh /opt/anaconda3/envs/$CUSTOM_ENV_NAME