R.rsp (version 0.5.2)

sourceAllRsp: Processes one or several RSP files

Description

Processes one or several RSP files.

Usage

## S3 method for class 'default':
sourceAllRsp(pattern="[.]rsp$", path=".", extension="html", outputPath=extension, overwrite=FALSE, ..., envir=parent.frame())

Arguments

pattern
A filename pattern.
path
The pathname of the directory to be search for RSP files.
extension
The filename extension to be used for the output files.
outputPath
The pathname of the directory where to save the output files.
overwrite
If FALSE, an error is thrown if an output file already exists, otherwise not.
...
Additional arguments passed to sourceRsp().
envir
An environment to be the working environment of the servlets, i.e. where RSP variables and objects are stored.

Value

  • Returns (invisibly) a character list of pathnames of all processed RSP files.

Exceptions

If an exception occurs while processing a file, the methods skips to the next one and records the error.

See Also

sourceRsp().

Examples

Run this code
# Copy the complete directory tree contain RSP files
rspPath <- system.file("rsp", package="R.rsp")
cat("RSP directory: ", rspPath, "")

# Create an output path to contain HTML files
outputPath <- tempdir()
cat("HTML directory: ", outputPath, "")

# Process all RSP files (not recursively)
files <- sourceAllRsp(path=rspPath, outputPath=outputPath, extension="html")

cat("Processed the following RSP files:
")
print(files)

# View generated documents
if (interactive()) {
  library(tools)
  indexFile <- filePath(outputPath, "index.html")
  cat("Trying to open '", indexFile, "' in default browser...
", sep="")
  browseURL(getAbsolutePath(indexFile))
}

Run the code above in your browser using DataCamp Workspace