ERROR: [on_request_read] connection reset by peer


#1

Hello Guys, my name is Danny , I’m new to the code academy forum. I wish to learn more about R and Python programming as a beginner.

I started working on a web application in R but I had this error message : ERROR: [on_request_read] connection reset by peer. Then I saw in the error number line:
unexpected closing bracket ‘}’,
unexpected token ‘)’, and
unexpected end of document.

Please find below the codes:

shinyServer(
function(input, output, session){
  output$myPlot <- renderPlot({
   distType <-input$Distribution
   size <- input$sampleSize
  
   if(distType=="Normal"){
     
     randomVec <- rnorm(size, mean = as.numeric(input$mean), sd=as.numeric(input$sd))
   }
    
   else{
     
     randomVec <- rexp(size, rate = 1/as.numeric(input$lambda))
   }
   
   hist(randomVec, col = "blue")
  }
    
  })

Thank you any help will be highly appreciated.


#2

i don’t know R, but to me it looks like you are short on parentheses/curly brackets

shinyServer( has no matching closing parenthesis )

check all your brackets/parentheses/curly brackets, verify that all of them are present and in the right place, being consistent with indent helps, if it doesn’t help, add comments so you know which brackets match what


#3

Hello stetim94, thank you it works , I was able to check my curly brackets and parenthesis and found some were missing. Thank you once again. My web application is now working accurately.


#4