我希望能够在通过shinyApp()函数调用运行的应用程序中使用 display.mode = 'showcase' 。根据该文件,我应该能够通过,去任何参数runApp()通过options论证。展示模式有效(窗口被拆分)但不显示代码。有趣的是,如果我运行runExample("01_hello")一切正常。我正在使用闪亮的 1.0.5。
代码:
library(shiny)
ui <- fluidPage(
titlePanel("Sample App"),
sidebarLayout(
sidebarPanel(
selectInput("data", label = "Data set",
choices = c("mtcars", "iris"))
),
mainPanel(
tableOutput("table")
)
)
)
server <- function(input, output) {
data <- reactive({
get(input$data, 'package:datasets')
})
output$table <- renderTable({
head(data())
})
}
shinyApp(ui, server, options = list(display.mode = 'showcase'))
Run Code Online (Sandbox Code Playgroud)
我也有同样的问题。我有 app.R 文件并使用记事本创建了描述文件,但无法使用代码部署闪亮的应用程序。然后我复制了描述文件shiny\examples\01_hello并注意到了这一点:
结果我的文件有一个 TXT 扩展名,所以 Shiny 没有将其作为元数据文件读取。一旦我使用了正确的描述文件(您可以使用记事本对其进行编辑),一切都会顺利进行。