0
votes

Shiny app, which is automatically generated by rstudio when you click (file > new file > shiny web app) doesn't work, turns to gray screen on chrome and RStudio crashes.

I noticed this when my own app crashed when I tried to add output of a ggplot chart. This template has a basic histogram, I guess the problem is about plots.

I only copy and paste template here

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)

my session info

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’
1
Your code seems to be working fine, may be port issue, try launching app with options(shiny.host = "127.0.0.1", shiny.port = port); runApp("app.R",host = getOption("shiny.host"), port = getOption("shiny.port") ,launch.browser = FALSE) - parth
thanks, but it didn't work, I tried shiny.port = 7336. Do you suggest any other port number ? - Selcuk Akbas
have you tried running any other app also, if it's successful use that port else reinstalling shiny might be alternative - parth
yes it works if I comment plot line # plotOutput("distPlot") - Selcuk Akbas
check this issue out, you'll find the solution here - parth

1 Answers

3
votes

This issue reported and solved here. https://github.com/rstudio/shiny/issues/1726

in short, packages needs to be updated when R updated to 3.4

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