- Difficulty level: easy
- Time need to lean: 10 minutes or less
- Key points:
- Action
report
generates plain text output and can be used to produce arbitrary log messages. - Action
pandoc
processes input document with pandoc - Action
Rmarkdown
process input document with Rmarkdown
- Action
Action report
writes some content to an output stream. The input can either be a string or content of one or more files specified by option input
. The output is determined by parameter output
.
- If
output='filename'
, the content will be written to a file. - If
output=obj
andobj
has awrite
function (e.g. a file handle), the content will be passed to thewrite
function - If output is unspecified, the content will be written to standard output.
For example, the content of report
actions is printed to standard output if no output is specified.
We can specify an output file with option output
, but the output will be overwritten if multiple actions write to the same file
Action report
can also take the content of one or more input files and write them to the output stream, after the script content (if specified). For example, the report
action in the following example writes the content of out.txt
to the default report stream (which is the standard output in this case).
Action pandoc
uses command pandoc to convert specified input to output. This input to this action can be specified from option script
(usually specified in script format) and input
.
First, if a script is specified, pandoc assumes it is in markdown format and convert it by default to 'HTML' format. For example,
You can specify an output with option output
You can convert input file to another file type using a different file extension
Or you can add more options to the command line by modifying args
,
The second usage of the pandoc
action is to specify one or more input filenames. You have to use the function form of this action as follows
If multiple files are specified, the content of these input files will be concatenated. This is very useful for generating a single pandoc output with input from different steps. We will demonstrate this feature in the Generating Reports tutorial.
If both script
and input
parameters are specified, the content of input files would be appended to script
. So
Action Rmarkdown
is very similar to pandoc
, the only difference is that it uses RMarkdown
to process the input, which is assumed to be of Rmarkdown format.