我有一些交互式的rmarkdown文档,我试图将它们链接在一起。问题是我不知道哪些可用,所以我无法通过[doc](path/to/doc.Rmd)
对链接进行硬编码。我无法弄清楚是否可以有一个反应性文档列表,我可以从中创建工作链接(这样可以点击它们,另一个交互式文档打开)。以下是一些失败的尝试:
---
runtime: shiny
---
### This works, but not reactive
[other](other.Rmd)
```{r}
vals <- reactiveValues(rmds="other.Rmd")
ui <- renderUI({
list(
selectInput("doc", "Document", vals$rmds),
actionButton("go", "Go")
)
})
ui
## Doesn't work
observeEvent(input$go, {
rmarkdown::run(input$doc)
})
```
```{r}
## Doesn't work
shinyApp(
shinyUI(
htmlOutput("links")
),
shinyServer(function(input, output, session) {
output$links <- renderUI({
tags$a(href=vals$rmds, vals$rmds)
})
})
)
```
---
title: "Other"
runtime: shiny
---
## Here I am