Skip to contents

Containerize R Markdown documents. This function generates Dockerfile based on the liftr metadata in the RMD document.

Usage

lift(
  input = NULL,
  use_config = FALSE,
  config_file = "_liftr.yml",
  output_dir = NULL
)

Arguments

input

Input (R Markdown) file.

use_config

If TRUE, will parse the liftr metadata from a YAML file, if FALSE, will parse such information from the metadata section in the R Markdown file. Default is FALSE.

config_file

Name of the YAML configuration file, under the same directory as the input file. Default is "_liftr.yml".

output_dir

Directory to output Dockerfile. If not provided, will be the same directory as input.

Value

Dockerfile.

Details

After running lift, run render_docker on the document to render the containerized R Markdown document using Docker containers. See vignette('liftr-intro') for details about the extended YAML front-matter metadata format used by liftr.

Examples

# copy example file
dir_example = paste0(tempdir(), '/liftr-minimal/')
dir.create(dir_example)
file.copy(system.file("examples/liftr-minimal.Rmd", package = "liftr"), dir_example)
#> [1] TRUE

# containerization
input = paste0(dir_example, "liftr-minimal.Rmd")
lift(input)

if (FALSE) {
# render the document with Docker
render_docker(input)

# view rendered document
browseURL(paste0(dir_example, "liftr-minimal.html"))

# purge the generated Docker image
purge_image(paste0(dir_example, "liftr-minimal.docker.yml"))}