output_rendered: Render an rmarkdown file and output the result file.

View source: R/output_rendered.R

output_renderedR Documentation

Render an rmarkdown file and output the result file.

Description

Render an rmarkdown file, save the result file and eventually display the output in the browser or send the output to one or more email recipients.

Usage

output_rendered(
  input,
  output_file,
  output_dir = tempdir(),
  intermediates_dir = tempdir(),
  params,
  display = FALSE,
  email = FALSE,
  from = NULL,
  to = NULL,
  subject = NULL,
  email_text = NULL,
  ...
)

Arguments

input

[character(1)]
The path to the rmarkdown document.

output_file

[character(1)]
The name of the output file.

output_dir

[character(1)]
The directory to save the output file. Defaults to tempdir().

intermediates_dir

[character(1)]
The directory to save intermediate files made by rmarkdown::render. Defaults to tempdir().

params

[list]
List of parameters to be passed to the rmarkdown document.

display

[logical(1) | character(1)]
If FALSE, don't display the results file. Can also be "browser" for the default browser or "viewer" for the R studio viewer. TRUE equals "browser". Defaults to FALSE.

email

[logical(1)]
Whether an email with the results file should be sent or not. Defaults to FALSE.

from

[character(1)]
The email address of the sender. Defaults to NULL.

to

[character]
The email address' of the recipients. Defaults to NULL.

subject

[character(1)]
Text in the subject line of the email. Defaults to NULL.

email_text

[character(1)]
Text to be written in the body of the email. Defaults to NULL.

...

Other arguments to be passed to rmarkdown::render and sendmailR::sendmail.

Details

The input to the argument params should be a list with parameters that is used by the rmarkdown document. The parameters must have been defined in the YAML-section of the rmarkdown document.

The default behaviour is to save the resulting html-file in the temporary directory. To save the result in a permanent file, use a permanent directory as input to output_dir.

The output can only be displayed in a browser or the R studio viewer in an interactive session. If you chose to display the output in the R studio viewer, but it is not an R studio session, the output will instead be output in the browser.

An email with the results file can be sent to one or more recipients.

Value

None. Render a rmarkdown file and either saves, emails or displays it in the browser.

Author(s)

Petter Hopp Petter.Hopp@vetinst.no


NorwegianVeterinaryInstitute/NVIbatch documentation built on Dec. 15, 2024, 3:15 p.m.