反复链接交互式R Markdown文档

时间:2015-07-17 19:54:40

标签: r shiny r-markdown

我有一些交互式的rmarkdown文档,我试图将它们链接在一起。问题是我不知道哪些可用,所以我无法通过[doc](path/to/doc.Rmd)对链接进行硬编码。我无法弄清楚是否可以有一个反应性文档列表,我可以从中创建工作链接(这样可以点击它们,另一个交互式文档打开)。以下是一些失败的尝试:

Main.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)
        })
    })
)
```

Other.Rmd

---
title: "Other"
runtime: shiny
---

## Here I am

0 个答案:

没有答案