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.
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")
)
x, invisibly
The (pre)registration form (as produced by a call
to preregr::form_create()
or preregr::import_from_html()
) or
initialized preregr
object (as produced by a call to
preregr::prereg_initialize()
or preregr::import_from_html()
); or, for
the printing method, the R Markdown template produced by a call to
preregr::form_to_rmd_template()
.
Optionally, a file to save the html to.
The title to specify in the template's YAML front matter.
The author to specify in the template's YAML front matter.
The date to specify in the template's YAML front matter.
The output format to specify in the template's YAML front matter.
It is also possible to specify the YAML front matter directly
using this argument. If used, it overrides anything specified in title
,
author
, date
and output
.
Whether to include the YAML front matter or omit it.
The chunk options to set for the chunks in the template.
Whether to use preregr::prereg_specify()
as function for
specifying the (pre)registration content (if FALSE
), or
preregr::prereg_justify()
(if TRUE
).
The level of the top-most heading to use (the title of the (pre)registration form).
Whether to show the specification in the Rmd
output. When FALSE
, the preregr
option silent
is set to TRUE
at
the start of the Rmd template; otherwise, it is set to FALSE
.
Set to FALSE
to override overwrite prevention.
Whether to be silent or chatty.
preregr::form_create(
title = "Example form",
version = "0.1.0"
) |>
preregr::form_to_rmd_template();
Run the code above in your browser using DataLab