gpt4 book ai didi

r - display.mode = 'showcase' 在 ShinyApp() 调用中 - 没有显示代码

转载 作者:行者123 更新时间:2023-12-04 11:22:57 24 4
gpt4 key购买 nike

我希望能够在使用 shinyApp() 运行的应用程序中使用 display.mode = 'showcase'函数调用。根据文档,我应该能够传递任何参数 runApp()通过 options争论。展示模式有效(窗口被拆分)但不显示代码。有趣的是,如果我运行 runExample("01_hello")一切正常。我正在使用 Shiny 的 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'))

输出:
shinyApp() with showcase mode not showing code

最佳答案

我遇到了同样的问题。我有 app.R 文件并使用记事本创建了说明文件,但无法使用代码部署 ShinyApp。然后我从 shiny\examples\01_hello 复制了描述文件并注意到这一点:

enter image description here

原来我的文件有一个 TXT 扩展名,所以 Shiny 没有将它作为元数据文件读取。一旦我使用了正确的描述文件(您可以使用记事本编辑),一切都很好。

关于r - display.mode = 'showcase' 在 ShinyApp() 调用中 - 没有显示代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47240756/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com