The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

ymlthis: write YAML for R Markdown, bookdown, blogdown, and more

R-CMD-check Codecov test coverage Lifecycle: maturing CRAN status

ymlthis makes it easy to write YAML front matter for R Markdown and related documents. yml_*() functions write functions and use_*() functions let you write the resulting YAML to your clipboard or to .yml files related to your project.

Installation

You can install ymlthis from CRAN with:

install.packages("ymlthis")

Or you can install the development version of ymlthis from GitHub with:

# install.packages("remotes")
remotes::install_github("r-lib/ymlthis")

Example

yml() creates a basic yml object returns simple YAML with the author and date.

library(ymlthis)

yml()
#> ---
#> author: Malcolm Barrett
#> date: '`r format(Sys.Date())`'
#> ---

ymlthis supports many YAML arguments, with YAML-generating functions prefixed with yml_*():

yml() %>% 
  yml_author(c("Yihui Xie", "Hadley Wickham"), affiliation = "RStudio") %>% 
  yml_date(lubridate::today()) %>% 
  yml_output(
    word_document(keep_md = TRUE), 
    bookdown::html_document2()
  ) %>% 
  yml_citations(bibliography = "references.bib", csl = "aje.csl")
#> ---
#> author:
#> - name: Yihui Xie
#>   affiliation: RStudio
#> - name: Hadley Wickham
#>   affiliation: RStudio
#> date: '2022-06-24'
#> output:
#>   word_document:
#>     keep_md: true
#>   bookdown::html_document2: default
#> bibliography: references.bib
#> csl: aje.csl
#> ---

Add-in

ymlthis also includes an add-in that will create YAML for you and put it in a file, such as an .Rmd file, or on your clipboard.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.