3

I try to build a shiny app with R but when I press RunApp the following Error Message appears:

TypeError 'undefined' is not an object (evaluating 'c.b.')

Any ideas to solve this problem? Shiny app looks like this:

ui.R:

library(shiny)
shinyUI(bootstrapPage(

  selectInput(inputId = "n_breaks",
              label = "Number of bins in histogram (approximate):",
              choices = c(10, 20, 35, 50),
              selected = 20),

  checkboxInput(inputId = "individual_obs",
                label = strong("Show individual observations"),
                value = FALSE),

  checkboxInput(inputId = "density",
                label = strong("Show density estimate"),
                value = FALSE),

  plotOutput(outputId = "main_plot", height = "300px"),

  # Display this only if the density is shown
  conditionalPanel(condition = "input.density == true",
                   sliderInput(inputId = "bw_adjust",
                               label = "Bandwidth adjustment:",
                               min = 0.2, max = 2, value = 1, step = 0.2)
  )

))

server.R:

library(shiny)
shinyServer(function(input, output) {

  output$main_plot <- renderPlot({

    hist(faithful$eruptions,
         probability = TRUE,
         breaks = as.numeric(input$n_breaks),
         xlab = "Duration (minutes)",
         main = "Geyser eruption duration")

    if (input$individual_obs) {
      rug(faithful$eruptions)
    }

    if (input$density) {
      dens <- density(faithful$eruptions,
                      adjust = input$bw_adjust)
      lines(dens, col = "blue")
    }

  })
})
N11
  • 39
  • 4
  • 1
    Read [this thread on making a good question on StackOverflow](http://stackoverflow.com/q/5963269/5977215), then update your question with enough code for others to reproduce your question – SymbolixAU Dec 17 '16 at 08:57
  • Thanks. But the code is working on other laptops (Windows). I am using Rstudio on Mac. – N11 Dec 17 '16 at 09:32
  • I try to run 5 or 6 shiny apps which are already working on other laptops... – N11 Dec 17 '16 at 09:34
  • okay so for example the app above is not working. I also cannot find anything about this error message on google or other blogs.. – N11 Dec 17 '16 at 10:14
  • your app is running fine on my system - Mac OS El Capitan running Rstudio (1.0.44 ) – SymbolixAU Dec 17 '16 at 21:37
  • I am using the same version 1.0.44. Did you change browser options on safari? – N11 Dec 18 '16 at 19:32
  • I used chrome - haven't tried safari – SymbolixAU Dec 18 '16 at 20:37
  • does the error appear in R (RStudio), or in the browser, as it looks like a javascript error – SymbolixAU Dec 18 '16 at 20:52
  • The error appears when I press RunApp in R. Do you have some more ideas to solve this problem? – N11 Dec 18 '16 at 21:12
  • I can only suggest to remove the UI elements one by one to try and find which one is causing the issue. – SymbolixAU Dec 18 '16 at 21:17
  • Please post the output from a `sessionInfo()` from the machine where you are getting the error. This will give us a better chance of a repro. It is probably something system or version dependent. It runs fine on my Windows 10 version 1607 machine with both R-Studio 0.99.903, R CRAN version 3.3.2, Shiny 0.14.2 and with RTVS 0.5, R Open 3.2.2, Shiny 0.12.2. A screen shot of the error would also help. – Mike Wise Dec 18 '16 at 23:56
  • Thanks for all comments! I solved it - when I run the app using the console, the app works fine! – N11 Dec 19 '16 at 10:58

0 Answers0