rfile

0th

Percentile

Evaluates and postprocesses an RSP document and outputs the final RSP document file

Evaluates and postprocesses an RSP document and outputs the final RSP document file.

Keywords
file, IO
Usage
## S3 method for class 'default':
rfile(file, path=NULL, output=NULL, workdir=NULL, type=NA, envir=parent.frame(),
  args="*", postprocess=TRUE, ..., verbose=FALSE)
Arguments
file, path
Specifies the RSP file to processed, which can be a file, a URL or a connection. If a file, the path is prepended to the file, iff given.
output
A character string or a connection specifying where output should be directed. The default is a file with a filename where
workdir
The working directory to use after parsing and preprocessing, but while evaluating and postprocessing the RSP document. If argument output specifies an absolute pathname, then the directory of outpu
type
The default content type of the RSP document. By default, it is inferred from the output filename extension, iff possible.
envir
The environment in which the RSP document is preprocessed and evaluated.
args
A named list of arguments assigned to the environment in which the RSP string is parsed and evaluated. See cmdArgs.
postprocess
If TRUE, and a postprocessing method exists for the generated RSP product, it is postprocessed as well.
...
Additional arguments passed to the RSP engine.
verbose
See Verbose.
Value

Processing RSP files from the command line

Using Rscript and rfile(), it is possible to process an RSP file from the command line. For example,

Rscript -e "R.rsp::rfile(file='RSP-refcard.tex.rsp', path=system.file('doc', package='R.rsp'))"

parses and evaluates RSP-refcard.tex.rsp and output RSP-refcard.pdf in the current directory.

See Also

rstring() and rcat().

Aliases
  • rfile.default
  • rfile
  • rfile.RspString
  • rfile.RspDocument
  • rfile.RspRSourceCode
  • rfile.function
Examples
path <- system.file("exData", package="R.rsp")
pathname <- rfile("random.txt.rsp", path=path)
print(pathname)

lines <- readLines(pathname, warn=FALSE)
cat(lines, collapse="")


# Passing arguments
path <- system.file("exData", package="R.rsp")
pathname <- rfile("random-args.txt.rsp", path=path, args=list(K=50))
print(pathname)

lines <- readLines(pathname, warn=FALSE)
cat(lines, collapse="")


# Compile and display the main vignette (requires LaTeX)
if (isCapableOf(R.rsp, "latex")) {
  path <- system.file("doc", package="R.rsp")
  pdf <- rfile("Dynamic_document_creation_using_RSP.tex.rsp", path=path)
  printf("Created document: %s
", pdf)
  if (interactive()) browseURL(pdf)
}
Documentation reproduced from package R.rsp, version 0.9.17, License: LGPL (>= 2.1)

Community examples

Looks like there are no examples yet.