Changing default umask in R studio server

Answering the closed topics here and here.

I solved this issue by

  1. adding "umask 002" to .bashrc - this changes permissions for R files produced in the terminal
  2. adding "Sys.umask('002') to .Rprofile - this changes permissions for R files produced in the console

I found that setting just the .bashrc led to a change in results from using "umask" in the Terminal but didn't change the results of "system('umask')" of Sys.umask() in the console. These two are changed by altering the .Rprofile. Hope this helps anyone having a similar issue.