【问题标题】:How to solve Error when trying to deploy shiny app or flexdashboard on shinyapps.io?尝试在 shinyapps.io 上部署闪亮的应用程序或 flexdashboard 时如何解决错误?
【发布时间】:2020-08-13 09:47:01
【问题描述】:

当我尝试将闪亮的教程示例“Hello Shiny”从here 发布到我的 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)

附加信息:

  • 在本地运行良好
  • 我在代理后面,因此我已经关注these instructions
  • 我使用的是 Windows 10
  • shinyrsconnectrmarkdown是最新的
  • 尝试使用闪亮运行时的 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    

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

【问题讨论】:

    标签: r shiny r-markdown flexdashboard


    【解决方案1】:

    尝试显式加载数据集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)
    

    【讨论】:

    • 您好,感谢您的快速回答!我尝试了您的建议,但仍然遇到同样的错误。
    猜你喜欢
    • 2019-04-24
    • 1970-01-01
    • 2019-07-14
    • 2017-09-05
    • 2018-02-03
    • 2020-09-30
    • 2019-04-17
    • 2018-05-24
    • 2021-04-30
    相关资源
    最近更新 更多