Christofer Bogaso
2018-Jun-25 21:04 UTC
[R] Correctly executing system code using R in Ubuntu server
Hi, I am curious on how to correctly run System code with R under Ubuntu. I tried to execute below 2 lines of code using system() functions in Ubuntu server, however could not achieve the desired result. system('Xvfb :10 -ac &') system('export DISPLAY=:10') System parameters:> Sys.info()sysname "Linux" release "4.4.0-128-generic" version "#154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018" nodename "ubuntu-s-2vcpu-4gb-blr1-01" machine "x86_64" login "root" user "root" effective_user "root" Background: I use RSelenium package to perform various testing using web-browser. I have installed firefox to do the same, however to make RSelenium work, it requires display parameter as guided in below link: https://medium.com/@griggheo/running-selenium-webdriver-tests-using-firefox-headless-mode-on-ubuntu-d32500bb6af2 I want to set those parameters through R, each time I start R in Ubuntu server. Appreciate for any pointer. Thanks, [[alternative HTML version deleted]]
William Dunlap
2018-Jun-25 21:15 UTC
[R] Correctly executing system code using R in Ubuntu server
Each call to system() starts and finishes a new shell so your approach will not work. Does the following do what you need?> system('Xvfb :10 -ac &') > Sys.setenv(DISPLAY=":10") > x11()Warning message: In x11() : cairo-based types may only work correctly on TrueColor visuals Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Jun 25, 2018 at 2:04 PM, Christofer Bogaso < bogaso.christofer at gmail.com> wrote:> Hi, > > I am curious on how to correctly run System code with R under Ubuntu. I > tried to execute below 2 lines of code using system() functions in Ubuntu > server, however could not achieve the desired result. > > system('Xvfb :10 -ac &') > system('export DISPLAY=:10') > > System parameters: > > Sys.info() > sysname > "Linux" > release > "4.4.0-128-generic" > version > "#154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018" > nodename > "ubuntu-s-2vcpu-4gb-blr1-01" > machine > "x86_64" > login > "root" > user > "root" > effective_user > "root" > > Background: > I use RSelenium package to perform various testing using web-browser. I > have installed firefox to do the same, however to make RSelenium work, it > requires display parameter as guided in below link: > https://medium.com/@griggheo/running-selenium-webdriver- > tests-using-firefox-headless-mode-on-ubuntu-d32500bb6af2 > I want to set those parameters through R, each time I start R in Ubuntu > server. > > Appreciate for any pointer. > > Thanks, > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Christofer Bogaso
2018-Jun-26 03:30 UTC
[R] Correctly executing system code using R in Ubuntu server
It worked. Thanks, On Tue, Jun 26, 2018 at 2:46 AM William Dunlap <wdunlap at tibco.com> wrote:> Each call to system() starts and finishes a new shell so your approach > will not work. > Does the following do what you need? > > > system('Xvfb :10 -ac &') > > Sys.setenv(DISPLAY=":10") > > x11() > Warning message: > In x11() : cairo-based types may only work correctly on TrueColor visuals > > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Mon, Jun 25, 2018 at 2:04 PM, Christofer Bogaso < > bogaso.christofer at gmail.com> wrote: > >> Hi, >> >> I am curious on how to correctly run System code with R under Ubuntu. I >> tried to execute below 2 lines of code using system() functions in Ubuntu >> server, however could not achieve the desired result. >> >> system('Xvfb :10 -ac &') >> system('export DISPLAY=:10') >> >> System parameters: >> > Sys.info() >> sysname >> "Linux" >> release >> "4.4.0-128-generic" >> version >> "#154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018" >> nodename >> "ubuntu-s-2vcpu-4gb-blr1-01" >> machine >> "x86_64" >> login >> "root" >> user >> "root" >> effective_user >> "root" >> >> Background: >> I use RSelenium package to perform various testing using web-browser. I >> have installed firefox to do the same, however to make RSelenium work, it >> requires display parameter as guided in below link: >> >> https://medium.com/@griggheo/running-selenium-webdriver-tests-using-firefox-headless-mode-on-ubuntu-d32500bb6af2 >> I want to set those parameters through R, each time I start R in Ubuntu >> server. >> >> Appreciate for any pointer. >> >> Thanks, >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > >[[alternative HTML version deleted]]