[R] CGIwithR installation failure [SOLVED]
rex
rex at nosyntax.net
Sun Jun 9 09:05:14 CEST 2013
rex <rex at nosyntax.net> [2013-06-08 18:05]:
>
>CGIwithR apparently is not available on CRAN for R 2.15.x, so I
>downloaded the source (0.73) and tried:
>
>~/Downloads$ R CMD INSTALL CGIwithR
Typo. Actually, I downloaded 0.72. Later, I found 0.73 here:
http://cran.r-project.org/src/contrib/Archive/CGIwithR/
D/L 0.73
tar -xzvf CGIwithR_0.73-0.tar.gz
R CMD INSTALL CGIwithR
* installing to library ‘/home/rex/R/x86_64-pc-linux-gnu-library/2.15’
* installing *source* package ‘CGIwithR’ ...
** package ‘CGIwithR’ successfully unpacked and MD5 sums checked
configure: creating ./config.status
config.status: creating R/CGIwithR.R
*****************************************
After the installation of this R package is complete
copy the files R.cgi and .Rprofile in
/home/rex/R/x86_64-pc-linux-gnu-library/2.15/CGIwithR/cgi-bin/
to the cgi-bin area of your Web server. If necessary,
modify the settings in the first part of R.cgi to
suit your local configuration.
*****************************************
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (CGIwithR)
My slightly modified R.cgi, trivial.html & trivial.R are
below for reference (I'm running Debian Testing & R 2.15.3).
R.cgi
#! /bin/sh
### A shell script to make CGI scripting possible in R. Part of the
### "CGIwithR" package for R.
###
### Author: David Firth, University of Warwick
### (d.firth at warwick.ac.uk)
###
### Terms of use: GPL version 2 or later. See "COPYING" in the
### R distribution.
###
### NO WARRANTY GIVEN, AND NO LIABILITY ACCEPTED FOR LOSS CAUSED BY
### USE OF THIS PROGRAM
###
###
### INSTALLING IT:
###
### This file, and the one-line ".Rprofile" file included with the
### package, must be placed together in a "cgi-bin" directory. Both
### files should be readable (and this file executable) by the web
### server.
###
###
### CONFIGURING IT:
###
### First locate R on the local system (typically the answer
### to "which R"). This is the command to run R.
### Individual R CGI scripts may request execution by a
### different, elsewhere-installed version of R; the R specified
### here is the default.
R_DEFAULT=/usr/bin/R
#R_DEFAULT=/usr/local/bin/R
### Graphs can be included in the output using either the
### GDD package (available from cran.r-project.org)
### or via ghostscript.
### GDD is the default. If it is not installed, the webPNG()
### function will attempt to use ghostscript. You can specify
### where the executable is located on your system via the R_GSCMD
### environment variable. If using GDD, you can ignore this.
R_GSCMD=/usr/bin/gs
#R_GSCMD=/usr/local/bin/gs
export R_GSCMD
### The next two lines may optionally be edited to limit access
### to local resources.
###
### This line allows specification of the priority
### given to the R process. A nice of "0" is the normal
### priority, while e.g. "+10" causes R to be run as a
### low-priority process. The value "NONE" should be given if
### nice is not implemented locally.
R_NICE=NONE
### This line allows the imposition of a length limit on the data
### entered on an HTML form for processing by an R script.
### Setting MAX_DATA_LENGTH=1000, for example, aborts
### execution if the data length exceeds 1000 characters. Or
### use MAX_DATA_LENGTH=NONE to impose no limit here.
MAX_DATA_LENGTH=1000
###
### To make use of packages not installed in the default library for R
### i.e. `R RHOME`/library/, set the environment R_LIBS to identify
### one or more library directories containing the packages (separated by :).
### This is only necessary if the CGIwithR package itself is not located
### in the default library, e.g. if one is using a different version.
R_LIBS=/home/rex/R/x86_64-pc-linux-gnu-library/2.15/
export R_LIBS
### No further configuration is needed.
No changes made in R.cgi below here.
trivial.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>An example form for CGIwithR</title>
<meta name="generator" content="BBEdit 6.1.2">
</head>
<FORM action="http://www.nosyntax.net/cgi-bin/R.cgi/trivial.R" method="POST">
<body>
Enter some words: <INPUT type="text" name="words" value="" size=20>
<BR><BR>
Now some numbers (separated by any kind of white space):<BR>
<textarea name="numbers" rows=6 cols=20></textarea>
<P><INPUT type="submit" size=3>
</body>
</html>
trivial.R
#! /usr/bin/R
tag(HTML)
tag(HEAD)
tag(TITLE)
cat("An example R.cgi output page")
untag(TITLE)
untag(HEAD)
comments("Some comments to be ignored by the web browser")
lf(2)
tag(BODY, bgcolor = "lightyellow")
lf(2)
tag(h3)
cat("A large heading")
untag(h3)
lf(2)
tag(p)
cat("Your words in italics:")
tag(i)
cat(formData$words)
untag(i)
untag(p)
lf(2)
tag(p)
cat("Your numbers:")
tag(pre)
numbers <- as.numeric(scanText(formData$numbers))
print(numbers)
untag(pre)
untag(p)
lf(2)
# cat("Here is a graph:") ; br()
# graphDir <- "/Users/david/Sites/graphs/"
# graphURLroot <- "/~david/graphs/"
# webPNG("temp.png")
# plot(numbers)
# img(src = "temp.png") ; br(2)
#
# lf(2)
cat("The author is ")
mailto("David Firth", "d.firth at warwick.ac.uk")
# mailto("David Firth", "david.firth at nuffield.ox.ac.uk")
cat(" and here is his ")
linkto("website.", "http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/") ; br()
#linkto("website.", "http://www.stats.ox.ac.uk/~firth/")
lf()
tag(p)
cat("Output produced at ", date())
untag(p)
-rex
--
If at first you do succeed, try not to look astonished.
More information about the R-help
mailing list