| yml_author {ymlthis} | R Documentation |
Set Top-level R Markdown YAML Fields
Description
These functions add common top-level YAML fields for R Markdown documents,
such as author, date, and title. Each takes a yml object and adds
fields related to the function, as well as checking for duplicate fields and
(where possible) checking for valid entries. yml_toplevel() is a catch-all
function that will take any named R object and put in the top level of the
YAML; it checks for duplicate fields but is unable to validate the input
beyond that it is valid YAML syntax. Some R Markdown templates allow for
additional variations of the YAML here. For instance, the distill package
adds url and affiliation_url to the author field (see
yml_distill_author, which wraps yml_author). Several yml_*() functions
also contain ... which allow for these unique fields.
Usage
yml_author(.yml, name = NULL, affiliation = NULL, email = NULL, ...)
yml_date(.yml, date = NULL, format = "")
yml_title(.yml, title)
yml_subtitle(.yml, subtitle)
yml_abstract(.yml, abstract)
yml_keywords(.yml, keywords)
yml_subject(.yml, subject)
yml_description(.yml, description)
yml_category(.yml, category)
yml_lang(.yml, lang)
yml_toplevel(.yml, ...)
Arguments
.yml |
a |
name |
A character vector, name of the author(s) |
affiliation |
The author's affiliation; must match length of |
email |
The author email address. Note that not all formats support the
|
... |
additional named R objects, such as characters or lists, to transform into YAML |
date |
The date; by default this is " |
format |
When the default |
title |
A character vector, the title of the document |
subtitle |
A character vector, the subtitle of the document. Not all R
Markdown formats use subtitles, so it may depend on what you use in the
output field (see |
abstract |
A character vector, the abstract. Long character vectors are
automatically wrapped using valid YAML syntax. This field is not available
in all output formats; it is available in |
keywords |
A character vector of keywords. This field is not available
in all output formats; it is available in |
subject |
A character vector, the subject of the document. This field is
not available in all output formats; it is available in |
description |
A character vector, a description of the document. This
field is not available in all output formats; it is available in
|
category |
A character vector, the category of the document. This field
is not available in all output formats; it is available in
|
lang |
The document language using IETF language tags such as "en" or "en-US". The Language subtag lookup tool can help find the appropriate tag. |
Value
a yml object
See Also
Other yml:
asis_yaml_output(),
bib2yml(),
draw_yml_tree(),
has_field(),
read_json(),
use_yml_defaults(),
use_yml_file(),
use_yml(),
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()
Examples
yml_empty() %>%
yml_author("Yihui Xie") %>%
yml_date("02-02-2002") %>%
yml_title("R Markdown: An Introduction") %>%
yml_subtitle("Introducing ymlthis") %>%
yml_abstract("This paper will discuss a very important topic") %>%
yml_keywords(c("r", "reproducible research")) %>%
yml_subject("R Markdown") %>%
yml_description("An R Markdown reader") %>%
yml_category("r") %>%
yml_lang("en-US")