RStudio does not execute `system` commands from Rprofile.site
Using Rstudio (version 1.0.143) on Ubuntu (16.04), if I add system("echo 'Hello world'")
to my /usr/lib/R/etc/Rprofile.site
file, I don't have a global welcome message displayed in R studio at startup. If I run R from the terminal, I have a Hello world message.
R studio seems to be ignoring commands system
from Rprofile.site
(idem from file .Rprofile
in home directory)
Can system commands be enabled, or is there a good reason to avoid this behavior?
source to share
In short, RStudio doesn't send the file Rprofile.site
at all. (I am using Ubuntu 17.04 and compiling R-3.4.1 myself)
test Rprofile.site
To just ask a question, you can use x=1
rather system("echo 'Hello world'")
in a file Rprofile.site
. Then you open RStudio:
> x
Error: object 'x' not found
This tells you if RStudio is ignoring commands system()
in Rprofile.site
or R studio is ignoring the entire file Rprofile.site
.
test system()
If you find your source is RStudio instead of a Rprofile.site
. You can try system("echo haha > x")
or system2('echo', 'haha', stdout = T) -> x
.
This tells you if RStudio is ignoring the commands system()
or if you don't see the message for other reasons.
what RStudio says
Finally see https://support.rstudio.com/hc/en-us/community/posts/200643758-Rprofile-site-
We don't actually implement the code to find Rprofile.site (R does)
Jan Pilweinen, Process Engineer at RStudio, Inc.
source to share