Rmd:访问'yaml\u元数据\u块`

Rmd:访问'yaml\u元数据\u块`,r,rstudio,knitr,r-markdown,pandoc,R,Rstudio,Knitr,R Markdown,Pandoc,在R Markdown中,如何准确地从非标头访问元数据 我的尝试不太奏效: --- title: "My YAML block test" output: pdf_document: md_extensions: +yaml_metadata_block --- next we want to define some data on-the-fly using YAML: --- myparam: somestring --- And try using it in the d

在R Markdown中,如何准确地从非标头访问元数据

我的尝试不太奏效:

---
title: "My YAML block test"
output:
  pdf_document:
    md_extensions: +yaml_metadata_block
---

next we want to define some data on-the-fly using YAML:

---
myparam: somestring
---

And try using it in the document:

This is first attempt -  myparam is: $myparam$
This is second attempt - myparam is: `r print(myparam)`

不确定,但可能会有帮助。谢谢,我还没有弄清楚如何使用多个输入文件作为命令行参数,即pandoc main.md additional.yaml-to latex-from markdown,通过knitr调用pandoc