【发布时间】:2015-12-30 16:08:53
【问题描述】:
试图将这些想法更进一步:
我想在 mainPanel 中包含一个响应式降价文件 (*.Md),以 selectInput 的输入为条件。我该怎么做?
我尝试了renderText、renderPrint 的变体,并在includeMarkdown 中使用了eval。到目前为止似乎没有任何效果。
EG。
### ui.R
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("var1",
label= "Please Select option",
choices= c("option1", "option2", "option3"),
selected= "option1"
),
mainPanel(
h3("guide:")
includeMarkdown("md_file")
)
)
))
### server.R
shinyServer(function(input, output) {
output$md_file <-
if (input$var1 == "option1") {
renderPrint({"option1.Md"})
} else if (input$var1 == "option2") {
renderPrint({"option2.Md"})
} (input$var1 == "option3") {
renderPrint({"option3.Md"})
}
})
})
R> shiny::runApp('C:/Shiny_demo')
收听http://127.0.0.1:6421
readLines(con) 中的警告:
无法打开文件“md_file”:没有这样的文件或目录
readLines(con) 中的错误:无法打开连接
【问题讨论】: