[R] X11 png jpeg cledit false when running from script
Marc Schwartz
MSchwartz at mn.rr.com
Thu Dec 15 04:59:46 CET 2005
On Wed, 2005-12-14 at 15:53 -0800, Jon Dressel wrote:
> Hello,
>
> When launching R from a script, when queried it reports the following
> capabilities as false: jpeg, png, x11 and cledit. When R is run from a
> terminal session, all of these capabilities are reported true. R is
> running on FC4. As the purpose of this script is to output the png file
> to a browser, it is unable to complete because of this. Any ideas are
> appreciated. We have an identical setup running on FC3 and there is not
> a problem.
>
> Thanks,
>
> Jon Dressel
Without the script you are using and perhaps how you installed R, it is
hard to provide specific details here, especially given the differences
you are observing between FC3 and 4.
In general, cledit being FALSE suggests that R is being run
non-interactively. So I am guessing that you are calling R from the
command line in some fashion and running a R program via stdin
redirection or running R in BATCH mode. For example:
$ echo "capabilities()" | R --slave --vanilla
jpeg png tcltk X11 http/ftp sockets libxml fifo
TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
cledit iconv NLS
FALSE TRUE TRUE
Note however that jpeg, png and X11 are all TRUE as I ran the above from
a console with X running on my FC 4 laptop using GNOME.
That jpeg, png and X11 are FALSE when running your script suggests that
the actual machine you are running R on in that instance is not running
an X server. That is what I get, for example, when I change to init 3
(text mode) and run the above again from the command line.
Are you running a remote login session of some type to a box that is not
running X or is your script calling a remote R session?
If so and you need to be able to generate plots, you can use bitmap()
which does not require X to be running, or you can also use Xvfb on the
other box, which is the X virtual frame buffer. See 'man Xvfb' for more
information.
I do the latter when performing certain analyses on a RHEL server
running Oracle 10g, where we have integrated some online reporting
functionality for clients. I wrote some R programs which create PNG
plots as required. Our DBA's call/run the R programs on the server via
TCL code and then put the resultant plots into an HTML page created
dynamically. The server is not running X, so we use Xvfb.
You might also want to see R FAQ 7.19 How do I produce PNG graphics in
batch mode?, which covers the above.
HTH,
Marc Schwartz
More information about the R-help
mailing list