Setting environment variables for RStudio

982 Views Asked by At

I am on Ubuntu 22.04. I am trying to create a new environment variable for R. In RStudio, I can see all the environment variables for R in RStudio terminal with the command:

printenv | grep ^R_

but the same doesn't work in a terminal outside of RStudio. I used

Sys.setenv(TMPDIR=/my/fav/path)

but it only persists for that R session. I tried using '.Renviron' file in my project folder as well but the attempt went in vain. Any help is appreciated. Thanks!

EDIT: I haven't been able to set any environment variable myself yet. I can only see them through the 'printenv' command in the terminal or 'Sys.getenv()' in R console. I am not sure where they are coming from.

0

There are 0 best solutions below