Reputation: 21
I'm trying to build an Rmarkdown report with a params argument which takes a list of various outputs (plots, tables and other objects chosen from a shiny app). The problem i'm having is showing all the outputs in the list with in a markdown report.
If we have a list of outputs:
outputs = list("A" = "Output...", "B" = summary(rnorm(100)), "C" = 111)
The desired output can be obtained by:
---
title: "Report"
output: html_document
params:
output: NA
---
```{echo = F}
outputs.list = params$output
outputs.list[[1]]
outputs.list[[2]]
outputs.list[[3]]
```
and rendering with the outputs: render("report.rmd", params = list(output = outputs))
.
However the length of output is unknown, how can I make the rmarkdown template dynamic to the length of the outputs list.
Upvotes: 2
Views: 97
Reputation: 21
The solution:
print(outputs.list)
Thanks @divibisan, I thought I had tried this but it is working now.
Upvotes: 0