【问题标题】:RStudio Shiny app crashesRStudio Shiny 应用程序崩溃
【发布时间】:2017-12-04 02:55:45
【问题描述】:

当您单击(文件>新文件>闪亮的网络应用程序)时,rstudio会自动生成闪亮的应用程序不起作用,在chrome上变成灰屏并且RStudio崩溃。

当我尝试添加 ggplot 图表的输出时,我自己的应用程序崩溃时,我注意到了这一点。这个模板有一个基本的直方图,我猜问题出在图上。

我这里只复制粘贴模板

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

# Application title
titlePanel("Old Faithful Geyser Data"),

# Sidebar with a slider input for number of bins 
sidebarLayout(
   sidebarPanel(
      sliderInput("bins",
                  "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)
   ),

   # Show a plot of the generated distribution
   mainPanel(
      plotOutput("distPlot")
   ) ) )
# Define server logic required to draw a histogram
server <- function(input, output) {

 output$distPlot <- renderPlot({
    # generate bins based on input$bins from ui.R
    x    <- faithful[, 2] 
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    # draw the histogram with the specified number of bins
    hist(x, breaks = bins, col = 'darkgray', border = 'white')
 }) } 
# Run the application 
shinyApp(ui = ui, server = server)

我的会话信息

sessionInfo() 
R version 3.4.0 (2017-04-21) 
Platform: x86_64-w64-mingw32/x64 (64-bit) 
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: 
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United States.1252    

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

loaded via a namespace (and not attached):  
[1] colorspace_1.3-1   scales_0.4.1      compiler_3.4.0   lazyeval_0.2.0   plyr_1.8.4    
[6] tools_3.4.0        gtable_0.2.0      tibble_1.3.3     Rcpp_0.12.11     ggplot2_2.2.1.9000
[11] grid_3.4.0         rlang_0.1.1       munsell_0.4.3  

packageVersion("shiny") # ‘1.0.3’

【问题讨论】:

  • 您的代码似乎运行良好,可能是port 问题,尝试使用options(shiny.host = "127.0.0.1", shiny.port = port); runApp("app.R",host = getOption("shiny.host"), port = getOption("shiny.port") ,launch.browser = FALSE) 启动应用程序
  • 谢谢,但没用,我试过shiny.port = 7336。你建议其他端口号吗?
  • 您是否也尝试过运行任何其他应用程序,如果成功则使用该端口,否则reinstalling shiny 可能是替代方案
  • 是的,如果我评论情节线# plotOutput("distPlot")
  • 查看issue,您会在这里找到解决方案

标签: r shiny rstudio


【解决方案1】:

这里报告并解决了这个问题。 https://github.com/rstudio/shiny/issues/1726

简而言之,当 R 更新到 3.4 时需要更新包

 update.packages(ask = FALSE, checkBuilt = TRUE)

【讨论】:

    猜你喜欢
    • 2017-11-05
    • 2016-08-28
    • 2015-01-20
    • 2015-09-09
    • 2023-04-11
    • 2011-03-31
    • 1970-01-01
    • 2021-10-08
    • 1970-01-01
    相关资源
    最近更新 更多