Package R.rsp. January 11, 2018

Similar documents
Package R.cache. April 4, 2011

Package R.devices. November 10, 2016

Package ezknitr. September 16, 2016

Package GetoptLong. June 10, 2018

Package R.huge. February 22, 2015

Package spelling. December 18, 2017

R.devices. Henrik Bengtsson. November 19, 2012

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package shinyhelper. June 21, 2018

Package docxtools. July 6, 2018

Package rprojroot. January 3, Title Finding Files in Project Subdirectories Version 1.3-2

Package taskscheduler

Package BiocStyle. January 26, 2018

Package cronr. March 3, 2017

Package SASmarkdown. R topics documented: November 30, Version Date Title 'SAS' Markdown

Package calpassapi. August 25, 2018

Package robotstxt. November 12, 2017

Package covr. October 18, 2018

Package radix. September 17, 2018

Package BiocManager. November 13, 2018

Package calmate. R topics documented: February 15, Version Depends R (>= ), R.utils (>= ), aroma.core (>= 2.8.

Package patchdvi. June 9, 2015

Package messaging. May 27, 2018

Package ECctmc. May 1, 2018

Package BiocStyle. December 9, 2018

Package tfruns. February 18, 2018

Package semver. January 6, 2017

Package pdfsearch. July 10, 2018

Package internetarchive

Package texpreview. August 15, 2018

Package pkgbuild. October 16, 2018

Package lumberjack. R topics documented: July 20, 2018

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package future.apply

Package io. January 15, 2018

Package githubinstall

Package fastdummies. January 8, 2018

Package ssh. June 4, 2018

Package edfreader. R topics documented: May 21, 2017

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package httpcache. October 17, 2017

Package gifti. February 1, 2018

Package filematrix. R topics documented: February 27, Type Package

Package htmlwidgets. July 10, 2017

Package kirby21.base

Package snakecase. R topics documented: March 25, Version Date Title Convert Strings into any Case

Package gtrendsr. October 19, 2017

Package workflowr. July 6, 2018

Package shinyfeedback

Package knitrprogressbar

Package htmlwidgets. February 25, 2016

Package desc. May 1, 2018

Package deductive. June 2, 2017

Package clipr. June 23, 2018

Package reval. May 26, 2015

Package coga. May 8, 2018

Package dotcall64. January 11, 2018

Package redux. May 31, 2018

Package liftr. R topics documented: May 14, Type Package

Package wikitaxa. December 21, 2017

Package validara. October 19, 2017

Package profvis. R topics documented:

Package fastqcr. April 11, 2017

Package benchmarkme. R topics documented: February 26, Type Package Title Crowd Sourced System Benchmarks Version 0.2.

Package barcoder. October 26, 2018

Package slickr. March 6, 2018

Package SEMrushR. November 3, 2018

Package repec. August 31, 2018

Package readmzxmldata

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package R.filesets. February 15, 2013

Package oec. R topics documented: May 11, Type Package

Package TinnR. February 15, 2013

R topics documented: 2 checkpoint-package

Package patchsynctex

The R.huge Package. September 1, 2007

Package gtrendsr. August 4, 2018

Package testit. R topics documented: June 14, 2018

Package jug. April 13, 2017

Package eply. April 6, 2018

Package TrafficBDE. March 1, 2018

Package loggit. April 9, 2018

Package formatr. February 15, 2013

Package fastrtext. December 10, 2017

Package blogdown. April 19, 2018

Package msgtools. March 2, 2017

Package jstree. October 24, 2017

Package modules. July 22, 2017

Package patentsview. July 12, 2017

Package ezsummary. August 29, 2016

Package projector. February 27, 2018

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package canvasxpress

Package bisect. April 16, 2018

Package narray. January 28, 2018

Package weco. May 4, 2018

Package rtext. January 23, 2019

Package memoise. April 21, 2017

Package remoter. August 29, 2016

Transcription:

Version 0.42.0 Depends R (>= 2.14.0) Package R.rsp January 11, 2018 Imports methods, stats, tools, utils, R.methodsS3 (>= 1.7.1), R.oo (>= 1.21.0), R.utils, R.cache (>= 0.13.0), digest (>= 0.6.13) Suggests tcltk, ascii (>= 2.1), markdown (>= 0.8), knitr (>= 1.9), R.devices (>= 2.15.1), base64enc (>= 0.1-3) SuggestsNote Recommended: R.devices, base64enc, markdown VignetteBuilder R.rsp Date 2018-01-09 Title Dynamic Generation of Scientific Reports Author Henrik Bengtsson [aut, cre, cph] Maintainer Henrik Bengtsson <henrikb@braju.com> Description The RSP markup language makes any text-based document come alive. RSP provides a powerful markup for controlling the content and output of LaTeX, HTML, Markdown, AsciiDoc, Sweave and knitr documents (and more), e.g. 'Today's date is <%=Sys.Date()%>'. Contrary to many other literate programming languages, with RSP it is straightforward to loop over mixtures of code and text sections, e.g. in month-by-month summaries. RSP has also several preprocessing directives for incorporating static and dynamic contents of external files (local or online) among other things. Functions rstring() and rcat() make it easy to process RSP strings, rsource() sources an RSP file as it was an R script, while rfile() compiles it (even online) into its final output format, e.g. rfile('report.tex.rsp') generates 'report.pdf' and rfile('report.md.rsp') generates 'report.html'. RSP is ideal for self-contained scientific reports and R package vignettes. It's easy to use - if you know how to write an R script, you'll be up and running within minutes. License LGPL (>= 2.1) URL https://github.com/henrikbengtsson/r.rsp BugReports https://github.com/henrikbengtsson/r.rsp/issues LazyLoad TRUE RoxygenNote 6.0.1 1

2 R.rsp-package NeedsCompilation no Repository CRAN Date/Publication 2018-01-10 23:57:00 UTC R topics documented: R.rsp-package........................................ 2 rcat............................................. 3 rfile............................................. 5 rstring............................................ 7 Index 8 R.rsp-package Package R.rsp Description The RSP markup language makes any text-based document come alive. RSP provides a powerful markup for controlling the content and output of LaTeX, HTML, Markdown, AsciiDoc, Sweave and knitr documents (and more), e.g. Today s date is <%=Sys.Date()%>. Contrary to many other literate programming languages, with RSP it is straightforward to loop over mixtures of code and text sections, e.g. in month-by-month summaries. RSP has also several preprocessing directives for incorporating static and dynamic contents of external files (local or online) among other things. Functions rstring() and rcat() make it easy to process RSP strings, rsource() sources an RSP file as it was an R script, while rfile() compiles it (even online) into its final output format, e.g. rfile( report.tex.rsp ) generates report.pdf and rfile( report.md.rsp ) generates report.html. RSP is ideal for self-contained scientific reports and R package vignettes. It s easy to use - if you know how to write an R script, you ll be up and running within minutes. Installation To install this package, call install.packages("r.rsp"). To get started We recommend that you start by reading one of the vignettes ; 1. A 5 minute slideshow covering the basics of RSP. 2. Detailed description of the RSP markup language. 3. A one-page RSP reference card. 4. How to use RSP for package vignettes. 5. How to use plain LaTeX for package vignettes. 6. How to use static PDF or HTML package vignettes. Then, when you re ready to try it yourself, these are commands you can start with:

rcat 3 1. Play with rcat(), which works like cat() but also processed RSP expressions, e.g. rcat("a random number: <%=sampl 2. To source a RSP document as you do with R scripts, use rsource(), e.g. rsource("report.md.rsp") which will run the RSP and display the output as it appears. 3. To compile a RSP document to a final document, use rfile(), e.g. rfile("report.md.rsp") outputs Markdown file report.md which is automatically compiled into a final report.html. Acknowledgments Several of the post-processing features of this package utilize packages such as base64enc, ascii, knitr, and markdown. Not enough credit can be given to the authors and contributors of those packages. Thank you for your great work. License The releases of this package is licensed under LGPL version 2.1 or newer. The development code of the packages is under a private licence (where applicable) and patches sent to the author fall under the latter license, but will be, if incorporated, released under the "release" license above. How to cite this package Bengtsson H (2018). R.rsp: Dynamic Generation of Scientific Reports. R package version 0.42.0, https://github.com/henrikbengtsson/r.rsp. Author(s) Henrik Bengtsson rcat Evaluates an RSP string and outputs the generated string Description Evaluates an RSP string and outputs the generated string. Usage ## Default S3 method: rcat(..., file=null, path=null, envir=parent.frame(), args="*", output="", buffered=true, append=false, verbose=false) ## Default S3 method: rsource(file, path=null, envir=parent.frame(), output="", buffered=false,...)

4 rcat Arguments... A character string with RSP markup. file, path Alternatively, a file, a URL or a connection from with the strings are read. If a file, the path is prepended to the file, iff given. envir The environment in which the RSP string 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. output A connection, or a pathname where to direct the output. If "", the output is sent to the standard output. buffered If TRUE, and output="", then the RSP output is outputted as soon as possible, if possible. append Only applied if output specifies a pathname; If TRUE, then the output is appended to the file, otherwise the files content is overwritten. verbose See Verbose. Value Returns (invisibly) the outputted RspStringProduct. Processing RSP strings from the command line Using Rscript and rcat(), it is possible to process an RSP string and output the result from the command line. For example, Rscript -e "R.rsp::rcat('A random integer in [1,<%=K%>]: <%=sample(1:k, size=1)%>')" --args --K=50 parses and evaluates the RSP string and outputs the result to standard output. rsource() The rsource(file,...) is a convenient wrapper for rcat(file=file,..., output="", buffered=false). As an analogue, rsource() is to an RSP file what source() is to an R script file. Author(s) Henrik Bengtsson See Also To store the output in a string (instead of displaying it), see rstring(). For evaluating and postprocessing an RSP document and writing the output to a file, see rfile(). Examples rcat("a random integer in [1,100]: <%=sample(1:100, size=1)%>\n") # Passing arguments rcat("a random integer in [1,<%=K%>]: <%=sample(1:k, size=1)%>\n", args=list(k=50))

rfile 5 rfile Evaluates and postprocesses an RSP document and outputs the final RSP document file Description Evaluates and postprocesses an RSP document and outputs the final RSP document file. Usage ## Default S3 method: rfile(file, path=null, output=null, workdir=null, type=na, envir=parent.frame(), args="*", postprocess=true,..., verbose=false) Arguments file, path output workdir type envir args postprocess 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. A character string or a connection specifying where output should be directed. The default is a file with a filename where the file extension (typically ".rsp") has been dropped from file in the directory given by the workdir argument. 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 output is used, otherwise the current directory is used. The default content type of the RSP document. By default, it is inferred from the output filename extension, iff possible. The environment in which the RSP document is preprocessed and evaluated. A named list of arguments assigned to the environment in which the RSP string is parsed and evaluated. See cmdargs. 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 Returns an RspProduct. If argument output specifies a file, then this is an RspFileProduct.

6 rfile 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. Author(s) Henrik Bengtsson See Also rstring() and rcat(). 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="\n") # 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="\n") ## Not run: # 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) cat("created document: ", pdf, "\n", sep="") if (interactive()) browseurl(pdf) } ## End(Not run)

rstring 7 rstring Evaluates an RSP string and returns the generated string Description Usage Evaluates an RSP string and returns the generated string. ## Default S3 method: rstring(..., file=null, path=null, envir=parent.frame(), args="*", verbose=false) Arguments Value... A character string with RSP markup. file, path envir args verbose Alternatively, a file, a URL or a connection from with the strings are read. If a file, the path is prepended to the file, iff given. The environment in which the RSP string is preprocessed and evaluated. A named list of arguments assigned to the environment in which the RSP string is parsed and evaluated. See cmdargs. See Verbose. Returns an RspStringProduct. Author(s) See Also Henrik Bengtsson To display the output (instead of returning a string), see rcat(). For evaluating and postprocessing an RSP document and writing the output to a file, see rfile(). Examples x <- rstring("a random integer in [1,100]: <%=sample(1:100, size=1)%>\n") cat(x) # Passing arguments x <- rstring("a random integer in [1,<%=K%>]: <%=sample(1:k, size=1)%>\n", args=list(k=50)) cat(x)

Index Topic IO rcat, 3 rfile, 5 rstring, 7 Topic file rcat, 3 rfile, 5 rstring, 7 Topic package R.rsp-package, 2 Topic print rcat, 3 cat, 3 character, 4, 5, 7 cmdargs, 4, 5, 7 connection, 4, 5, 7 environment, 4, 5, 7 list, 4, 5, 7 R.rsp (R.rsp-package), 2 R.rsp-package, 2 rcat, 3, 3, 6, 7 rfile, 3, 4, 5, 7 Rscript, 4, 6 rsource, 3 rsource (rcat), 3 RspFileProduct, 5 RspProduct, 5 RspStringProduct, 4, 7 rstring, 4, 6, 7 TRUE, 4, 5 Verbose, 4, 5, 7 8