wflow_convert: Convert R Markdown files to workflowr template.

Description Usage Arguments Details Value Warning See Also Examples

Description

wflow_convert converts existing R Markdown files to use the workflowr template. This is especially useful when migrating an existing project with many R Markdown files to use workflowr.

Usage

1
wflow_convert(files, standalone = FALSE, dry_run = FALSE, verbose = TRUE)

Arguments

files

character. The R Markdown file(s) to be converted. Must have file extension Rmd or rmd. Supports file globbing.

standalone

logical (default: FALSE). Embed the configuration chunks directly in the document to create a standalone file. Should only need to be used when creating files outside the context of a workflowr project.

dry_run

logical (default: FALSE). Preview the changes to the files. Show the output of diff between the original and the proposed replacement.

verbose

logical (default: TRUE). Report progress.

Details

wflow_convert attempts to identify the current state of each R Markdown file and convert it to the latest version of the workflowr template. Specifically, it can perform any of the following conversions:

If a given R Markdown file is already using the latest version of the template, it is not changed.

If a file is lacking a YAML header, a generic YAML header is added.

Value

Invisibly returns a list which contains the results of running diff between the original and converted versions of each file. The names of the list elements are the filenames. The diffs are character vectors. Only files which were successfully converted are included.

Warning

wflow_convert overwrites the original files.

See Also

wflow_open

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 

# Convert an R Markdown file to use workflowr template
wflow_convert("existing.Rmd")
# Convert an R Markdown file to use workflowr template,
# but embed the shared chunks to create a standalone file
wflow_convert("existing.Rmd", standalone = TRUE)
# Preview the changes
wflow_convert("existing.Rmd", dry_run = TRUE)
# Convert multiple an R Markdown files
wflow_convert(files = list.files(path = "analysis",
                                 pattern = "Rmd$",
                                 full.names = TRUE))

## End(Not run)

jdblischak/workflowrBeta documentation built on May 17, 2019, 7:28 p.m.