尝试在Shinyapps.io上部署闪亮的应用程序或Flexdashboard时,如何解决错误?

时间:2020-04-29 10:24:07

标签: r shiny r-markdown flexdashboard

当尝试甚至将闪亮的教程示例“ Hello Shiny”从here发布到我的Shinyapps.io帐户时,我都会收到以下错误消息:

var result = text.Substring(0, text.IndexOf("@")+1) + text.Substring(text.IndexOf("@")+1).Replace("@", "");

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

app.R

其他信息:

  • 在本地运行正常
  • 我是代理人,因此我已经关注these instructions
  • 我正在使用Windows 10
  • 软件包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) shinyrsconnect是最新的
  • 在运行时运行闪亮的Flexdashboard时会发生相同的错误

sessionInfo

rmarkdown

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

1 个答案:

答案 0 :(得分:0)

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