将应用程序部署到Shinyapps.io服务器时出错

时间:2020-03-24 09:01:06

标签: r shiny rstudio shinyapps

当我刚编写一个可以在本地完美运行的应用程序时,但是当我尝试在线部署它时,却不断出现此错误:

错误消息:

准备部署应用程序...完成 应用程序:1969928 ... curl :: curl_fetch_memory(url,handle = 句柄):已达到超时:[api.shinyapps.io]操作已计时 10000毫秒后退出,收到0个字节中的0个调用: ... tryCatch-> tryCatchList-> tryCatchOne-> 时间停止在:0 0 10

我的闪亮版本:1.4.0.2; 操作系统:Windows10; IDE:RStudio;

非常感谢您的帮助!

我的完整代码:

library(shiny)
library(DT)
library(readr)

######################### read data #########################
pump1 <- read_csv("data/1.csv", col_names=TRUE)
pump2 <- read_csv("data/2.csv", col_names=TRUE)
pump3 <- read_csv("data/3.csv", col_names=TRUE)
pump4 <- read_csv("data/4.csv", col_names=TRUE)
pump5 <- read_csv("data/5.csv", col_names=TRUE)
pump6 <- read_csv("data/6.csv", col_names=TRUE)
# pump7 does not have instantFlow feature
pump7 <- read_csv("data/7.csv", col_names=TRUE)

colnames(pump1) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump2) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump3) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump4) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump5) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump6) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump7) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "openDegree", "vacuumDegree")

######################### ui #########################

ui <- fluidPage(
  h1("Data Presentation", align = "center"),
  br(),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "data", label = "choose data to display", choices = c(
        "pump 1", "pump 2", "pump 3", "pump 4", "pump 5", "pump 6", "pump 7"
      )),
      # contents: Data summary
      h3(textOutput(outputId = "caption")),
      verbatimTextOutput(outputId = "summary"),
      width = 3
    ),
    mainPanel(
      DT::dataTableOutput(outputId = "DToutput", height = 0.5)
    )
  ),
  hr(),
  h1("roc-auc curve", align = "center"),
  br(),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "chooseImg", label = "choose a pump to estimate others",
                  choices = c("pump1 vs all", "pump2 vs all", "pump3 vs all", "pump4 vs all", "pump5 vs all", "pump6 vs all", "pump7 vs all"))
                ),
    mainPanel(
      imageOutput(outputId = "image")
    )
  ),
)
######################### server #########################

server <- function(input, output) {
  ############################# 1st part #############################
  # Now, data is a reactive expression,
  # when the select box changes, data changes to the spefic pump data accordingly
  data <- reactive({
    switch(input$data, 
           "pump 1" = pump1,
           "pump 2" = pump2,
           "pump 3" = pump3, 
           "pump 4" = pump4,
           "pump 5" = pump5, 
           "pump 6" = pump6, 
           "pump 7" = pump7)
    })

  output$caption <- renderText("Data summary")

  output$summary <- renderPrint({
    summary(data())
  })

  output$DToutput <- DT::renderDataTable(data())

  ############################# 2nd part #############################
  # toDisplay <- switch(
  #   input$chooseImg,
  #   "pump1 vs all" = list(src = "images/roc_1vsall.png"),
  #   "pump2 vs all" = list(src = "images/roc_2vsall.png"),
  #   "pump3 vs all" = list(src = "images/roc_3vsall.png"),
  #   "pump4 vs all" = list(src = "images/roc_4vsall.png"),
  #   "pump5 vs all" = list(src = "images/roc_5vsall.png"),
  #   "pump6 vs all" = list(src = "images/roc_6vsall.png"),
  #   "pump7 vs all" = list(src = "images/roc_7vsall.png")
  # )

  output$image <- renderImage({
    if (is.null(input$chooseImg))
      return(NULL)

    if (input$chooseImg == "pump1 vs all")
      return(list(src = "images/roc_1vsall.png"))

    else if (input$chooseImg == "pump2 vs all")
      return(list(src = "images/roc_2vsall.png"))

    else if (input$chooseImg == "pump3 vs all")
      return(list(src = "images/roc_3vsall.png"))

    else if (input$chooseImg == "pump4 vs all")
      return(list(src = "images/roc_4vsall.png"))

    else if (input$chooseImg == "pump5 vs all")
      return(list(src = "images/roc_5vsall.png"))

    else if (input$chooseImg == "pump6 vs all")
      return(list(src = "images/roc_6vsall.png"))

    else if (input$chooseImg == "pump7 vs all")
      return(list(src = "images/roc_7vsall.png"))
  }, deleteFile = FALSE)

}

shinyApp(ui, server)

1 个答案:

答案 0 :(得分:0)

尝试删除 rsconnect 文件夹并从头安装 一旦我完成了以下步骤,我的项目就遇到了这个问题:

  • 从项目文件夹中删除 rsconnect 文件夹
  • 使用 RStudio 中的发布按钮从头开始重新安装应用