use_yml {ymlthis} | R Documentation |
Copy YAML code to your clipboard or write to a new R Markdown file
Description
use_yml()
takes a yml
object and puts the resulting YAML on your
clipboard to paste into an R Markdown or YAML file. use_rmarkdown()
takes
the yml
object and writes it to a new R Markdown file. You can add text to
include in the body of the file. If it's not specified, use_rmarkdown()
will use setup_chunk()
by default. You can also set a default for body
using options(ymlthis.rmd_body = "{your text}")
; see use_rmd_defaults()
.
Together with specifying default YAML (see use_yml_defaults()
),
use_rmarkdown()
also serves as an ad-hoc way to make R Markdown templates.
You may also supply use_rmarkdown()
with an existing R Markdown file from
which to read the YAML header; the YAML header from the template is then
combined with .yml
, if it's supplied, and written to a new file.
use_index_rmd()
is a wrapper around use_rmarkdown()
that specifically
writes to a file called index.Rmd
. By default, use_yml()
and
use_rmarkdown()
use the most recently printed YAML via last_yml()
.
Usage
use_yml(.yml = last_yml())
use_rmarkdown(
.yml = last_yml(),
path,
template = NULL,
include_yaml = TRUE,
include_body = TRUE,
body = NULL,
quiet = FALSE,
open_doc = interactive(),
overwrite = getOption("usethis.overwrite", FALSE)
)
use_index_rmd(
.yml = last_yml(),
path,
template = NULL,
include_yaml = TRUE,
include_body = TRUE,
body = NULL,
quiet = FALSE,
open_doc = interactive()
)
Arguments
.yml |
a |
path |
A file path to write R Markdown file to |
template |
An existing R Markdown file to read YAML from |
include_yaml |
Logical. Include the template YAML? |
include_body |
Logical. Include the template body? |
body |
A character vector to use in the body of the R Markdown file. If
no template is set, checks |
quiet |
Logical. Whether to message about what is happening. |
open_doc |
Logical. Open the document after it's created? By default,
this is |
overwrite |
Logical. If |
Value
use_yml()
invisibly returns the input yml
object
See Also
Other yml:
asis_yaml_output()
,
bib2yml()
,
draw_yml_tree()
,
has_field()
,
read_json()
,
use_yml_defaults()
,
use_yml_file()
,
yml_author()
,
yml_blogdown_opts()
,
yml_bookdown_opts()
,
yml_citations()
,
yml_clean()
,
yml_distill_opts()
,
yml_latex_opts()
,
yml_output()
,
yml_pagedown_opts()
,
yml_params()
,
yml_pkgdown()
,
yml_reference()
,
yml_replace()
,
yml_resource_files()
,
yml_rsconnect_email()
,
yml_rticles_opts()
,
yml_runtime()
,
yml_site_opts()
,
yml_toc()
,
yml_vignette()