Discussion:
[R] Non-interactive sessions
Neil E. Klepeis
1999-09-17 23:07:30 UTC
Permalink
Greetings,

Quick Summary: How does R function non-interactively? I can't print
graphics to an X11 window.

I set up what appears to be called a "noninteractive" R session using
the Perl code at the end of this message. Everthing seems to work fine
as written. I get a nice postscript file with my graphics.

However, I would like to display X11 R-graphics for the Perl-script
user. Is there some way of sending commands to R to configure this
"noninterative mode"? Especially so that I can produce X11 graphics.

Another related issue: When I first sent the pipe to R (with no
options) it didn't work and I got the following error message:

" Fatal error : you must specify '--save', '--no-save', or '--vanilla' "

What is the '--vanilla' option all about?


Regards,
Neil


Appendix: My Perl Code
------------------------------------------
use FileHandle;
$R = new FileHandle ("| R --no-save");
$R->print("postscript(\"myfile.ps\")\n");
$R->print("dev.print(postscript)\n");
$R->print("curve(sin(x),-pi,pi)\n");
$R->print("dev.off()\n");
-------------------------------------------
--
___________________________________________________________
Neil E. Klepeis, School of Public Health, UC Berkeley, USA
Web: http://socrates.berkeley.edu/~nklepeis
Email: nklepeis at uclink4.berkeley.edu
Voice: 510-848-5827
-------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thomas Lumley
1999-09-17 23:18:12 UTC
Permalink
Post by Neil E. Klepeis
Greetings,
Quick Summary: How does R function non-interactively? I can't print
graphics to an X11 window.
I set up what appears to be called a "noninteractive" R session using
the Perl code at the end of this message. Everthing seems to work fine
as written. I get a nice postscript file with my graphics.
However, I would like to display X11 R-graphics for the Perl-script
user. Is there some way of sending commands to R to configure this
"noninterative mode"? Especially so that I can produce X11 graphics.
You need to explicitly start an x11 driver if you are not running
interactively, ie using the x11() function.
Post by Neil E. Klepeis
Another related issue: When I first sent the pipe to R (with no
" Fatal error : you must specify '--save', '--no-save', or '--vanilla' "
What is the '--vanilla' option all about?
--vanilla is a debugging option. As R --help reports:

--vanilla Combine --no-save, --no-restore,--no-site-file,
--no-init-file, and --no-environ.


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
1999-09-17 23:33:08 UTC
Permalink
Post by Neil E. Klepeis
However, I would like to display X11 R-graphics for the Perl-script
user. Is there some way of sending commands to R to configure this
"noninterative mode"? Especially so that I can produce X11 graphics.
Like this?

use FileHandle;
$R = new FileHandle ("| R --no-save");
$R->print("X11()\n");
$R->print("curve(sin(x),-pi,pi)\n");
$R->print("locator()\n");

You need some kind of interactivity to keep R from taking the window
down immediately.
Post by Neil E. Klepeis
Another related issue: When I first sent the pipe to R (with no
" Fatal error : you must specify '--save', '--no-save', or '--vanilla' "
What is the '--vanilla' option all about?
'R --help' will tell you.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Continue reading on narkive:
Loading...