sourceRsp
From R.rsp v0.5.0
by Henrik Bengtsson
Processes an RSP file by translating it to an R servlet, which is then sourced
Processes an RSP file by translating it to an R servlet, which is then sourced.
Usage
## S3 method for class 'default':
sourceRsp(..., response=FileRspResponse(file = stdout()), request=NULL, envir=parent.frame(), verbose=FALSE)
Arguments
- ...
- Arguments passed to
translateRspV1
(), e.g.file
andpath
. - response
- An
RspResponse
object to which output is passed. This object can be accessed by the RSP code. - request
- An optional
HttpRequest
object describing the request. IfNULL
, one is created refering to the request RSP file. This object can be accessed - envir
- An
environment
to be the working environment of the servlet, i.e. where RSP variables and objects are stored. - verbose
- Either a
logical
, anumeric
, or aVerbose
object specifying how much verbose/debug infor
Details
When "sourcing" an RSP file, the RSP code is first translated to an Rservlet, which is plain Rsource code. Then the servlet is sourced, and it in turns outputs the final response, e.g. an HTML document.
Value
- Returns what the Rservlet code returns.
See Also
translateRspV1
().
sourceAllRsp
().
Examples
# The RSP file
rspPath <- system.file("rsp/rsp/docs", package="R.rsp")
rspFile <- file.path(rspPath, "helloWorld.rsp")
file.show(rspFile)
# The HTML (output) file
outPath <- tempdir()
response <- FileRspResponse(file="helloWorld.html", path=outPath)
# Process RSP file
sourceRsp(file=rspFile, response=response)
# View generated document
file.show(getOutput(response))
Community examples
Looks like there are no examples yet.