R: Take a snapshot of an R Markdown document

rmdshot {webshot} | R Documentation

## Take a snapshot of an R Markdown document

### Description

This function can handle both static Rmd documents and Rmd documents with `runtime: shiny`.

### Usage

    rmdshot(doc, file = "webshot.png", ..., delay = NULL, rmd_args = list(),
      port = getOption("shiny.port"), envvars = NULL)

### Arguments

`doc` | The path to a Rmd document.
`file` | A vector of names of output files. Should end with `.png`, `.pdf`, or `.jpeg`. If several screenshots have to be taken and only one filename is provided, then the function appends the index number of the screenshot to the file name.
`...` | Other arguments to pass on to `webshot`.
`delay` | Time to wait before taking screenshot, in seconds. Sometimes a longer delay is needed for all assets to display properly. If NULL (the default), then it will use 0.2 seconds for static Rmd documents, and 3 seconds for Rmd documents with runtime:shiny.
`rmd_args` | A list of additional arguments to pass to either `render` (for static Rmd documents) or `run` (for Rmd documents with runtime:shiny).
`port` | Port that Shiny will listen on.
`envvars` | A named character vector or named list of environment variables and values to set for the Shiny app's R process. These will be unset after the process exits. This can be used to pass configuration information to a Shiny app.

### Examples

    if (interactive()) {
      rmdshot("doc.rmd", "doc.png")
    }

[Package webshot version 0.5.0 Index]