[R] running R from PHP
brook@biology.nmsu.edu
brook at biology.nmsu.edu
Wed Feb 4 15:44:30 CET 2004
Below are 2 scripts (png.R and pdf.R) I am trying to run in R from
PHP.
# png.R
x11(display=":5")
png(filename="g.png")
plot(1:5)
graphics.off()
# pdf.R
pdf(file="g.pdf")
plot(1:5)
graphics.off()
Both run from terminals and png.R will run without a normal X server
if Xvfb is running. Neither runs under PHP, though (when invoked as
"R --no-save < xxx.R"). They yield the following errors (with the R
startup banner deleted for compactness):
> x11(display=":5")
> png(filename="g.png")
Error in X11(paste("png::", filename, sep = ""), width, height, pointsize, :
unable to start device PNG
In addition: Warning message:
could not open PNG file `g.png'
Execution halted
and
> pdf(file="/usr/pkg/share/httpd/htdocs/test-R/g.pdf")
Error in PDF(file, old$family, old$encoding, old$bg, old$fg, width, height, :
unable to start device pdf
In addition: Warning message:
cannot open `pdf' file argument `/usr/pkg/share/httpd/htdocs/test-R/g.pdf'
Execution halted
For reference, the R banner information includes the following:
R : Copyright 2003, The R Development Core Team
Version 1.6.2 (2003-01-10)
Any help on how to get these scripts to work is greatly appreciated.
Cheers,
Brook
More information about the R-help
mailing list