1

有问题的闪亮应用程序有 250 行代码,因此我将尝试复制下面的相关代码段,但生成一个重现我遇到的问题的工作示例可能是不切实际的。

当我运行闪亮的应用程序时,它在本地完美运行。当我将它部署到 shinyapps.io 时,我会收到成功消息并且没有错误或警告。但是,当我在浏览器中查看 shinyapps.io 时,没有一个 valueboxes 或 ggplots 可见。

我怀疑问题可能是内存(数据集是 500K 行)。也许闪亮的应用程序服务器在加载之前内存不足?同样,日志(或将应用程序部署到 shinyapps.io 时的部署选项卡上)没有警告、错误或相关消息。

在 ui 中,我有这些行显示各种图和值框:

                  #Value boxes to show numeric stats
                  fluidRow(
                    valueBoxOutput("comp_fare"),
                    valueBoxOutput("num_comp_fares"),
                    valueBoxOutput("num_aa_fares")
                  ),

                  br(),
                  h2("Impact of continuous features on fares"),

                  #Select continuous variables
                  fluidRow(
                    column(selectInput(inputId = "continuous_variable",
                                label = "Choose a Variable to Compare: ",
                                choices = df %>% 
                                  select_if(is.numeric) %>% select(-fare) %>% 
                                  names,
                                selected = "distance"
                    ), width = 6),
                    column(selectInput(inputId = "fit_method",
                                label = "Choose a Fit Method: ",
                                choices = c("Linear", "Quadratic"),
                                selected = "Linear"
                    ), width = 6)
                  ),

                  br(),

                  #Plot continuous variables
                  fluidRow(
                    plotOutput("cont_plot")
                  ),

                  br(),
                  h2("Impact of discrete features on fares"),

                  #Select factor variables
                  fluidRow(
                    column(selectInput(inputId = "factor_variable",
                                label = "Choose a Variable to Compare: ",
                                choices = df %>% 
                                  select_if(is.factor) %>% 
                                  names,
                                selected = "hub_airport"
                    ), width = 6),
                    column(selectInput(inputId = "display_layout",
                                       label = "Choose a Display Layout: ",
                                       choices = c("Fill", "Dodge"),
                                       selected = "Dodge"
                    ), width = 6)
                  ),

                  br(),

                  #Plot factor variables
                  fluidRow(
                    plotOutput("cat_plot")
                  ),

#server code

#ValueBoxes
  output$comp_fare <- renderValueBox({
valueBox(competitor_fare_difference(),
         "Difference in Competitor Fare",
         icon = icon("dollar"),
         color = "yellow") 
  })

output$cont_plot <- renderPlot({
ggplot() +
  geom_smooth(data = df2(), 
              aes_string(input$continuous_variable, "fare", color = "carrier"), 
              method = "lm",
              formula = y ~ poly(x, fit_method())) +
  geom_point(data = sample_n(df2(), 1000), 
             aes_string(input$continuous_variable, "fare", color = "carrier"), 
             alpha = .3) +
  theme_bw() +
  scale_y_continuous(labels = dollar) +
  labs(title = paste0("Comparison of American Airlines and ", input$competitor),
       x = input$continuous_variable,
       y = "Round-trip Fare ($US)"
       ) %>% print
  })
4

1 回答 1

0

问题是shinyapps.io 服务器上的可用内存。我将我的数据集采样到更小的东西,它运行得很好。如果其他人遇到这种情况,我没有看到任何错误或警告,只是加载失败。我希望它可以帮助别人!

于 2017-07-28T15:22:38.570 回答