Search code examples
rjupyter-labrprofile

How to load .Rprofile and .Renviron files from an existing R project in JupyterLab?


I currently have an R project that I created in Rstudio. For this project I created an .Rprofile file. Lately, I've been using JupyterLab to test things, and while I set the same working directory (setwd("~/path/to/project")) as the same as the project I created in RStudio, the R session in JupyterLab doesn't read the project's .Rprofile.

How can share a project's .Rprofile and .Renviron files between RStudio and JupyterLab?


Solution

  • You can load the files manually, e.g. in your first Jupyter cell:

    source("/path/to/.Rprofile")
    readRenviron("/path/to/.Renviron")