
Convert a (pre)registration form to an R Markdown template
Source:R/form_to_rmd_template.R
rmd_templates.Rd
This function creates an R Markdown template from a {preregr} (pre)registrations form specification. Pass it the URL to a Google Sheet holding the (pre)registration form specification (in {preregr} format), see the "Creating a form from a spreadsheet" vignette), the path to a file with a spreadsheet holding such a specification, or a loaded or imported {preregr} (pre)registration form.
Usage
form_to_rmd_template(
x,
file = NULL,
title = NULL,
author = NULL,
date = "`r format(Sys.time(), \"%H:%M:%S on %Y-%m-%d %Z (UTC%z)\")`",
output = "html_document",
yaml = list(title = title, author = author, date = date, output = output),
includeYAML = TRUE,
chunkOpts = "echo=FALSE, results='hide'",
justify = FALSE,
headingLevel = 1,
showSpecification = FALSE,
preventOverwriting = rock::opts$get("preventOverwriting"),
silent = rock::opts$get("silent")
)
Arguments
- x
The (pre)registration form (as produced by a call to
preregr::form_create()
orpreregr::import_from_html()
) or initializedpreregr
object (as produced by a call topreregr::prereg_initialize()
orpreregr::import_from_html()
); or, for the printing method, the R Markdown template produced by a call topreregr::form_to_rmd_template()
.- file
Optionally, a file to save the html to.
- title
The title to specify in the template's YAML front matter.
The author to specify in the template's YAML front matter.
- date
The date to specify in the template's YAML front matter.
- output
The output format to specify in the template's YAML front matter.
- yaml
It is also possible to specify the YAML front matter directly using this argument. If used, it overrides anything specified in
title
,author
,date
andoutput
.- includeYAML
Whether to include the YAML front matter or omit it.
- chunkOpts
The chunk options to set for the chunks in the template.
- justify
Whether to use
preregr::prereg_specify()
as function for specifying the (pre)registration content (ifFALSE
), orpreregr::prereg_justify()
(ifTRUE
).- headingLevel
The level of the top-most heading to use (the title of the (pre)registration form).
- showSpecification
Whether to show the specification in the Rmd output. When
FALSE
, thepreregr
optionsilent
is set toTRUE
at the start of the Rmd template; otherwise, it is set toFALSE
.- preventOverwriting
Set to
FALSE
to override overwrite prevention.- silent
Whether to be silent or chatty.