Here is some R markdown code in a "test_param.Rmd" file:
---
output: pdf_document
params:
number: "1"
title: `r params$number`
---
```{r setup, include=TRUE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r one, include = TRUE}
i = 2
#data = data.frame(x = c(1,2,3))
#for(i in 1:dim(data)[1]){
# plot(i*1000)
#}
```
`r params$number`
that is called using a .r file here:
library(rmarkdown)
rmarkdown::render("C://Users//me//Desktop//test_param.Rmd",
params = list(number= "1"))
I get this error when I run the .r
Error in yaml::yaml.load(enc2utf8(string), ...) :
Scanner error: while scanning for the next token at line 4, column 8found character that cannot start any token at line 4, column 8
Any idea why?
I am using `` not '' to do the title: r params$number