[R] R from within a web page

David Galligani david at xicnet.com
Mon Jan 14 22:44:58 CET 2008


Hi all ,
I need to create some graphics from/for an Apache server .
With php I extract data from a PostgreSQL db , and i'd like to create 
some graphic from the data .
I have 2 questions :
1) I've tried with an exec("/usr/local/bin/R --vanilla < myfile.R") and 
exec("/usr/local/bin/R  --no-save < myfile.R > myfile.out.R ) . Both 
command work from a shell but not called from within a php page .
Myfile.R is generated by the php code and is actually something like this :

y <- c(16.0938,16.1562,16.0938,16.1875,[...]);
x<-c(0.29,0.34,0.39,0.44,0.49,0.54,0.59,[...]);
png(file="/var/www/htdocs/temp.png",bg="transparent");
plot(x,y,type="h",col=2,xlab="Time",ylab="Temperature",lwd=3);
dev.off()

The resulting image is 0 byte .

2)One axis represent time , so actually I have some empties spaces ( 
when I execute myfile.R from shell )  because the graphic is built in 
100 basis and not 60 .

Could someone please help ?

Thx in advance

David




More information about the R-help mailing list