sourceAllRsp {R.rsp}R Documentation

Processes one or several RSP files

Description

Processes one or several RSP files.

Usage

## Default S3 method:
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.

Author(s)

Henrik Bengtsson (http://www.braju.com/R/)

See Also

sourceRsp().

Examples

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

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

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

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

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

[Package R.rsp version 0.3.4 Index]