Does knitr know the value of YAML data e.g. title: or date: or some_custom_field: while it is compiling an rmarkdown doc with a YAML header?
I would like to be able to do this (pseudocode)
---
title: my title
---
The title of this document is `r knitrs_yaml_array("title")`
YAML header is a short blob of text, specially formatted with key: value pairs tags, that seats at the top of our Rmarkdown document. The header not only dictates the final file format, but a style and feel for our final document.
When you run render , R Markdown feeds the . Rmd file to knitr, which executes all of the code chunks and creates a new markdown (. md) document which includes the code and its output. The markdown file generated by knitr is then processed by pandoc which is responsible for creating the finished format.
The first code chunk: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` is used to specify any global settings to be applied to the R Markdown script. The example sets all code chunks as “echo=TRUE”, meaning they will be included in the final rendered version.
That is stored in rmarkdown::metadata
as a list of the form list(title = ...)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With