Reputation: 4370
Using Rstudio (Version 1.0.143) under Ubuntu (16.04), if I add system("echo 'Hello world'")
to my /usr/lib/R/etc/Rprofile.site
file, I have no Hello world message displayed in R studio at startup.
If I start R from the terminal I have the Hello world message.
It seems that R studio ignores the system
commands from Rprofile.site
(idem from the .Rprofile
file in the home directory)
Is it possible to enable system commands executions or is there a good reason to avoid this behavior ?
Upvotes: 1
Views: 667
Reputation: 639
For short, RStudio doesn't source Rprofile.site
file at all. (I use Ubuntu 17.04 and compile R-3.4.1 myself)
Rprofile.site
To simply the question, you can use x=1
rather system("echo 'Hello world'")
in the Rprofile.site
file. Then you open RStudio:
> x
Error: object 'x' not found
That tells you whether RStudio ignores the system()
commands in Rprofile.site
or R studio ignores the entire Rprofile.site
file.
system()
If you find that your RStudio source theRprofile.site
file instead. You can try system("echo haha > x")
or system2('echo', 'haha', stdout = T) -> x
.
That tells you whether RStudio ignores the system()
commands or you can't see the message due to other reasons.
Finally, see https://support.rstudio.com/hc/en-us/community/posts/200643758-Rprofile-site-
We don't actually implement the code for sourcing Rprofile.site (R does)
by Ian Pylvainen, Support Engineer at RStudio, Inc.
Upvotes: 2