Passing parameters in rmarkdown to the text or headings

Viewed 1561

Is there any way to pass parameters in an rmarkdown document outside of a code chunk? For example, I'd love to have the ability to have a parameter value be a heading.

Here is a short example .Rmd file:

---
title: "param_test"
author: "test"
date: "September 14, 2017"
output: pdf_document
params:
  param_test: this_text
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## I want this heading to be the value of params$param_test

```{r cars}
params$param_test

print(params$param_test)
```

Does anyone have any ideas on this?

1 Answers
Related