What is the correct way to pass a variable to a code chunk option?

21 views
Skip to first unread message

Joe Hightower

unread,
Sep 28, 2017, 12:50:30 PM9/28/17
to knitr
I am stuck with a problem I cannot solve.  I am using child documents in an rmarkdown report.  I have a number of different reports to generate form a Shiny app, so I am trying to organize the files used into a set of file folders.  The problem is that I cannot seem to reference the children files correctly.  I keep getting the error:

Quitting from lines 32-32 ("C:/Users/jch1748/Documents/Projects/W2017010 - Combined Risk Tool/testing/ReportTemplates/QA_Templates/introductionQA.Rmd") 

Warning: Error in readLines: cannot open the connection

in the following ddir contains the results of getwd()

My syntax looks like this:

---
output: html_document
runtime: shiny
params:
  Author:  NA
  Title:  NA
  Date:  NA
  AR:  NA
  P10:  NA
  OID:  NA
  OIO:  NA
  DID:  NA
  DIO:  NA
  IID:  NA
  IIO:  NA
  lkMtrx:  NA
  rskMtrx:  NA
  ddir:  NA
---

<center> <h1>A Risk Analysis Report for `r params$Title`</h1> </center>


<center> <h3>Authored by: `r params$Author`</h1> </center>

<center> <h3>`r params$Date`</h1> </center>

<br> </br>
<br> </br>


```{r child = paste(params$ddir, "/testing/ReportTemplates/QA_Templates/introductionQA.Rmd",sep="")}
```

```{r child = 'summaryQA.Rmd'}
```

```{r child = 'resultsQA.Rmd'}
```

```{r child = 'LikeresultsQA.Rmd'}
```

```{r child = 'RiskresultsQA.Rmd'}
```



Reply all
Reply to author
Forward
0 new messages