| use_template {usethis} | R Documentation |
Creates a file from data and a template found in a package. Provides control
over file name, the addition to .Rbuildignore, and opening the file for
inspection.
use_template(template, save_as = template, data = list(), ignore = FALSE, open = FALSE, package = "usethis")
template |
Path to template file relative to |
save_as |
Name of file to create. Defaults to |
data |
A list of data passed to the template. |
ignore |
Should the newly created file be added to |
open |
Open the newly created file for editing? Happens in RStudio, if
applicable, or via |
package |
Name of the package where the template is found. |
This function can be used as the engine for a templating function in other
packages. The template argument is used along with the package argument
to determine the path to your template file; it will be expected at
system.file("templates", template, package = package).
To interpolate your data into the template, supply a list using
the data argument. Internally, this function uses
whisker::whisker.render() to combine your template file with your data.
A logical vector indicating if file was modified.
## Not run:
# Note: running this will write `NEWS.md` to your working directory
use_template(
template = "NEWS.md",
data = list(Package = "acme", Version = "1.2.3"),
package = "usethis"
)
## End(Not run)