Hello all. I installed R 4.1.3 and RStudio-Server 2.22.12.0 on a Linux (RHEL 8.7) server. For every RStudio user, there is an automatically created "R" directory in the user's home directory, like /home/username/R. In my case, the /home mount point doesn't have much size so I am trying to set everything to run & save to a different directory that has much more storage allocated.
I've changed the "TMPDIR", the Library path to download & install packages, the working directory (setwd) and the Default working directory that is within the Global Options. So now all these don't use the /home/username/R directories. It's working as expected when downloading & installing packages.
However, when I run R scripts, even a small scoped one, for some reason, it still consumes quite a bit of storage in the R directories, as well as the hidden directory /home/username/.local. What are these and is there a way to prevent it from using the /home/username storage and instead using the other directory that has more storage? Please advise.
See below Linux command results after running the R script that gets a list of directories that use the most storage in the /home/username directory.
I've configured the "XDG_DATA_HOME" and "XDG_STATE_HOME" in RStudio console by running Sys.setenv(XDG_DATA_HOME="/rstudio/servername/username") and Sys.setenv(XDG_STATE_HOME="/rstudio/servername/username"). Now when I run the Sys.getenv command in RStudio, it returns the correct path I would like the user-specific data files and state files to go to. However, after that, I restarted the rstudio-server service and my RStudio console session, I ran the script again and noticed it was still writing the files to /home/username/.local/share/rstudio.
Any ideas why ? Did I do it wrong so it didn't take effect or anything else I need to do? Does it require a new session to be started and if yes, would I reset all the environment variables again in the new session?
I've added the systemd init system command for the rstudio-server service as mentioned in the linked documentation (see below). Is "XDG_DATA_HOME" the only environment variable I should add in my case? What about "XDG_STATE_HOME"? If I also should add that, would that be one more line to add in the rstudio-server service editor?