簡體   English   中英

嘗試在 shinyapps.io 上部署 shiny 應用程序或 flexdashboard 時如何解決錯誤?

[英]How to solve Error when trying to deploy shiny app or flexdashboard on shinyapps.io?

在嘗試將 shiny 教程示例“Hello Shiny”從此處發布到我的 shinyapps.io 帳戶時,我收到以下錯誤消息:

Error in `$<-.data.frame`(`*tmp*`, "config_url", value = "https://www.shinyapps.io/admin/#/application/") : replacement has 1 row, data has 0

app.R文件中的代碼如下所示:

library(shiny)

ui <- fluidPage(

  titlePanel("Hello Shiny!"),

  sidebarLayout(

    sidebarPanel(

      sliderInput(inputId = "bins",
                  label = "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)

    ),

    mainPanel(

      plotOutput(outputId = "distPlot")

    )
  )
)

server <- function(input, output) {

  output$distPlot <- renderPlot({

    x    <- faithful$waiting
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    hist(x, breaks = bins, col = "#75AADB", border = "white",
         xlab = "Waiting time to next eruption (in mins)",
         main = "Histogram of waiting times")

  })

}

shinyApp(ui = ui, server = server)

附加信息:

  • 在本地它工作正常
  • 我在代理后面,因此我已經按照這些說明進行操作
  • 我正在使用 Windows 10
  • 軟件包shinyrsconnectrmarkdown是最新的
  • 嘗試使用 shiny 運行時的 flexdashboard 時發生相同的錯誤

會話信息

Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.4.0.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4       digest_0.6.25    later_1.0.0      mime_0.9         R6_2.4.1         xtable_1.8-4     jsonlite_1.6.1   magrittr_1.5    
 [9] rlang_0.4.5      curl_4.3         promises_1.1.0   Cairo_1.5-10     tools_3.5.2      httpuv_1.5.2     yaml_2.2.1       rsconnect_0.8.16
[17] fastmap_1.0.1    compiler_3.5.2   askpass_1.1      htmltools_0.4.0  openssl_1.3    

我真的很感激任何提示。 謝謝

嘗試顯式加載數據集attach(faithful)

library(shiny)
attach(faithful)

ui <- fluidPage(

    titlePanel("Hello Shiny!"),

    sidebarLayout(

        sidebarPanel(

            sliderInput(inputId = "bins",
                        label = "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)

        ),

        mainPanel(

            plotOutput(outputId = "distPlot")

        )
    )
)

server <- function(input, output) {

    output$distPlot <- renderPlot({
        x    <- faithful$waiting
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        hist(x, breaks = bins, col = "#75AADB", border = "white",
             xlab = "Waiting time to next eruption (in mins)",
             main = "Histogram of waiting times")

    })

}

shinyApp(ui = ui, server = server)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM