Learn R Programming

workflowr (version 0.3.0)

wflow_build: Build the website

Description

wflow_build builds the website by rendering the R Markdown files in the analysis directory and saving them to docs/. By default it only renders the R Markdown files that have been modified more recently than their corresponding HTML file (similar to a Makefile). To render every single page (e.g. to change the theme across the entire site), set all = TRUE. To render specific R Markdown files, pass them as a vector to the argument files.

Usage

wflow_build(all = FALSE, files = NULL, dry_run = FALSE, path = ".", ...)

Arguments

all

logical indicating if every R Markdown file should be rendered when building the site (default: FALSE).

files

R Markdown files to be rendered. The files can be specified using the path or just the basename (default: NULL).

dry_run

Identifies R Markdown files that have been updated, but does not render them.

path

By default the function assumes the current working directory is within the project. If this is not true, you'll need to provide the path to the project directory.

...

Additional arguments that can be passed to rmarkdown::render_site. Should only be needed for testing potential changes. Any permanent settings should be specified in analysis/_site.yml.

Value

If dry_run = TRUE, returns the character vector of R Markdown files that would be rendered. Otherwise invisibly returns this vector.

Details

Under the hood, this runs rmarkdown::render_site on each updated file individually. This provides all the website styling specified in _site.yml (which you would lose if you ran rmarkdown::render) without re-building the entire site (which would happen if you ran rmarkdown::render_site with no arguments).

To include R Markdown files in your workflowr project that are not included as part of the website, you have multiple options: 1) Prepend an underscore to the filename, 2) move them to a subdirectory within the analysis directory, or 3) move them to another directory at the root of your project.

Examples

Run this code
# NOT RUN {
# View the files that would be rendered
wflow_build(dry_run = TRUE)
# Render all modified files
wflow_build()
# Render all files
wflow_build(all = TRUE)
# Render specific files
wflow_build(files = c("one.Rmd", "two.Rmd"))
# }

Run the code above in your browser using DataLab