闪亮的反应性功能一天到一天都不起作用

时间:2019-01-11 09:34:36

标签: r shiny

我对stackoverflow非常陌生,对R Shiny还是很陌生,因此感谢您为我的问题提供帮助。

我写了一个运行在Linux服务器上的闪亮应用程序。一切工作正常,但未对用户界面或服务器调用进行任何更改,该应用的两个部分突然停止工作:

  • 点击“更多”标签不再有效
  • 在“下载中心”中选择一个选项不会显示数据集,并且下载按钮也不起作用

我已经重新启动了该应用几次,并检查了所有软件包是否已正确安装,但没有任何更改。我也没有收到任何错误消息,并且在/ var / log / shiny-server中也没有错误日志。

这是我的代码:

ui <- navbarPage("My App",
tabPanel("Welcome",
         includeHTML("rmd_files/03_welcome.html")
         ),
tabPanel("Download Center",
         fluidRow(
           column(width = 6,
                  h1("Download Center"),
                  p("In this area you can find our Download Center."),
                  p("Select the dataset you are interested in on the left and a description as well as a preview will appear below."),
                  p("You can also download any dataset as a csv to explore it further.")
                  ),
           column(width = 6,
                  # move column down by 20px
                  style = "top: 20px;",
                  # Input: Choose dataset
                  selectInput("dataset", "Choose a dataset:",
                              choices = c("Choose...",
                                          "TestA",
                                          "TestB",
                                          "TestC"
                                          )),
                  # Button: Download data
                  downloadButton("downloadData", "Download CSV")
                  )
         ),
         hr(),
         h4("Dataset description"),
         textOutput("desc_dc"),
         hr(),
         tableOutput("table_dc")
         ),
navbarMenu("More",
           tabPanel("Presentations",
                    p("under construction")
                    ),
           tabPanel("Feature Assessment",
                    p("under construction"),
                    p("Example: ...")
           )
           )
)

##### Define server logic
server <- function(input, output, session) {

# Download Center: Reactive output for selected dataset
dc_dataset <- reactive({
switch(input$dataset,
       "TestA" = testa,
       "TestB" = testb,
       "TestC" = testc
       )
})

# Download Center: Table of selected dataset
output$table_dc <- renderTable({
dc_dataset()
})

# Download Center: Downloadable csv of selected dataset
output$downloadData <- downloadHandler(
filename = function() {
  paste(input$dataset, "_", Sys.Date(), ".csv", sep = "")
},
content = function(file) {
  write.csv(dc_dataset(), file, row.names = FALSE)
}
)

# Download Center: Reactive output for selected dataset  
dc_description <- reactive({
switch(input$dataset,
       "TestA" = testa_desc,
       "TestB" = testb_desc,
       "TestC" = testc_desc
       )
})

# Download Center: Dataset descriptions
output$desc_dc <- renderText({
dc_description()
})

}


# Create Shiny app
shinyApp(ui = ui, server = server)

您能发现一些其他想法可能会有所帮助吗?可能与我的R版本,Linux等有关吗?

>system('shiny-server --version', intern = TRUE)
[1] "Shiny Server v1.5.7.907" "Node.js v8.10.0"

>R --version
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

>cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"

1 个答案:

答案 0 :(得分:0)

以防万一其他人遇到相同的问题:显然,我在应用程序中包含的某些Rmd文件的html干扰了其他功能的正常运行。我通过在解决问题的iFrame中包含这些html来解决了该问题。我对此并不满意,但至少现在整个应用程序都可以再次使用。