by Henrik Bengtsson 2002-2005.
The below part is cut-n-pasted from the help documentation part of the R.rsp package as it was September 2005. For a more up to date version, please see the R.rsp package.
R Server Pages, or short RSPs, is an R technology that allows developers to dynamically generate documents of any format, e.g. HTML and LaTeX, but also R code. It allows R code to be embedded into static content.
An RSP is translated into an R servlet, which consists of standard R code, by an RSP translator. When the servlet is evaluated it outputs the final document. This process is illustrated in Figure 1.
| translation | evaluation | |||
| RSP | => | R servlet | => | final document |
| (index.rsp) | (index.rsp.R) | (index.html) |
An example of an RSP is:
Counting to ten:<% for (count in 1:10) { %> <%=count%><% } %>. Done!
which when translated becomes an R servlet with R source code:
page <- RspPage(pathname="../inst/rsp/incl/simpleExample.rsp");
out <- getOutput(response);
write(response, "Counting to ten:");
for (count in 1:10) {
write(response, " ");
write(response, count);
}
write(response, ". Done!\n");
(the variable response is an instance of class RspResponse, not needed to be understood in order to write RSP:s). When the R servlet is evaluated, it outputs:
This is a cross-platform package implemented in plain R. This package depends on the packages R.oo [2] and R.utils packages. Note that no webserver is required to process RSP documents.
To install this package, please follow the instructions at http://www.braju.com/R/.
[1] JavaServer Pages, WikiPedia, 2005.
http://en.wikipedia.org/wiki/JavaServer_Pages
[2] Henrik Bengtsson, The R.oo package - Object-Oriented Programming
with References Using Standard R Code, In Kurt Hornik, Friedrich
Leisch and Achim Zeileis, editors, Proceedings of the 3rd
International Workshop on Distributed Statistical Computing
(DSC 2003), March 20-22, Vienna, Austria.
http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/
| http://www.maths.lth.se/help/R/R.rsp/ | Validate! |