#---------------------File Name: simpleR.pl------------------- #! /usr/local/bin/perl -w use Apache::Request () ; use strict ; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # You only need to modify this: my $Rpath = "C:\\R\\rw\\bin\\" ; # path to rterm.exe # The rest will hopefully run itself. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # to execute R cmd: R($Rpath, $R_cmd) sub R { my $Rpath = shift ; my $Rcmd = $Rpath . "rterm --vanilla --quiet --slave" ; my $Rscript = shift ; $Rscript =~ s/(\r|;\r)/ ;/gm ; $Rscript =~ s/<-/=/gm ; # \r or +<- break "echo" return `echo $Rscript | $Rcmd` ; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - my $r = shift ; # Apache stuff my $q = Apache::Request->new($r) ; # Apache Query obj my $command = $q->param('command') ; my $result = $command ? R($Rpath, $command) : "You didn't input any co +mmand." ; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - print "Content-type: text/html\n\n"; print <<"EOF"; <html><body> <form method="get" action="./simpleR.pl"> Please enter your R command:<br> <textarea rows="4" name="command" cols="60">$command</textarea +><br> <input type="submit" value="Submit"> </form><br> <textarea rows="10" name="result" cols="80">$result</textarea> </body></html> EOF exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Statistical Analysis via Browser
by particle (Vicar) on Jun 19, 2003 at 13:08 UTC | |
|
Re: Statistical Analysis via Browser
by Itatsumaki (Friar) on Jun 19, 2003 at 14:53 UTC | |
by chunlou (Curate) on Jun 19, 2003 at 20:24 UTC |