R.rsp-package {R.rsp}R Documentation

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:

  1. Play with rcat(), which works like cat() but also processed RSP expressions, e.g. rcat("A random number: <%=sample(100, size=1)%>\n").

  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, 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 (2024). R.rsp: Dynamic Generation of Scientific Reports. R package version 0.46.0, https://github.com/HenrikBengtsson/R.rsp, https://henrikbengtsson.github.io/R.rsp/.

Author(s)

Henrik Bengtsson


[Package R.rsp version 0.46.0 Index]