title: Why is the object 'values' not found in R?
body: <p>I have tried again and again but I don't know why the errors still there, this is the code I tried :</p>
  
  <pre><code>library(shiny)
  library(neuralnet)
  require(ggplot2)
  
  # global
  traininginput &lt;-  as.data.frame(runif(50, min=0, max=100))
  trainingoutput &lt;- sqrt(traininginput)
  trainingdata &lt;- cbind(traininginput,trainingoutput)
  colnames(trainingdata) &lt;- c("Input","Output")
  testdata &lt;- as.data.frame((1:13)^2) 
  
  ui &lt;- fluidPage(
    fluidRow(
      column(width = 12, class = "well",
             h4("Neural Network Plot"),
  
             plotOutput("main_plot"),
  
             hr(),
  
             numericInput(inputId = "HL1_noN",
                          label = "Hidden Layer 1 : Number of Neuron:",
                          value = 5),
  
             numericInput(inputId = "HL2_noN",
                          label = "Hidden Layer 2 : Number of Neuron:",
                          value = 5), 
  
             numericInput(inputId = "TL",
                          label = "Treshold level:",
                          value = 0.01,
                          step  = 0.01),
  
             actionButton("update", "Update View"),
  
             br(),
             br(),
  
             numericInput(inputId = "rmse_",
                           label = "Root Mean Square Error",
                           value = sqrt(sum((sqrt(testdata)- net.results)^2)/length(net.results))))))
  #--------------------------------------------------------------------------------------------
  server &lt;- function(input, output, session) {
  
    values &lt;- reactiveValues(
  
      net.sqrt &lt;- neuralnet(Output~Input,trainingdata, hidden=c(values$HL1_noN, values$HL2_noN), threshold=values$TL),
      net.results &lt;- predict(net.sqrt, testdata), 
      cleanoutput &lt;- cbind(testdata,sqrt(testdata),
                           as.data.frame(net.results)),
      colnames(cleanoutput) &lt;- c("Input","ExpectedOutput","NeuralNetOutput"),
  
      rmse_ = sqrt(sum((sqrt(testdata)- net.results)^2)/length(net.results)),
  
      HL1_noN = 5,
      HL2_noN = 5,
      TL      = 0.007,
      rmse_   = sqrt(sum((sqrt(testdata)- net.results)^2)/length(net.results)))
  
    observeEvent(input$update, {
      net.sqrt &lt;- neuralnet(Output~Input,trainingdata, hidden=c(values$HL1_noN, values$HL2_noN), threshold=values$TL)
      net.results &lt;- predict(net.sqrt, testdata) 
      cleanoutput &lt;- cbind(testdata,sqrt(testdata),
                           as.data.frame(net.results))
      colnames(cleanoutput) &lt;- c("Input","ExpectedOutput","NeuralNetOutput")
  
      values$HL1_noN &lt;- input$HL1_noN
      values$HL2_noN &lt;- input$HL2_noN
      values$TL      &lt;- input$TL
      values$rmse_   &lt;- input$rmse_ })
  
    output$main_plot &lt;- renderPlot({
      net.sqrt &lt;- neuralnet(Output~Input,trainingdata, hidden=c(values$HL1_noN, values$HL2_noN), threshold=values$TL)
      net.results &lt;- predict(net.sqrt, testdata)
      cleanoutput &lt;- cbind(testdata,sqrt(testdata),
                           as.data.frame(net.results))
      colnames(cleanoutput) &lt;- c("Input","ExpectedOutput","NeuralNetOutput")
      ggplot(data = cleanoutput, aes(x= ExpectedOutput, y= NeuralNetOutput)) + geom_point() +
        geom_abline(intercept = 0, slope = 1
                    , color="brown", size=0.5)})}
  
  shinyApp(ui,server)
  
  # rmse_ = sqrt(sum((sqrt(testdata)- net.results)^2)/length(net.results))
  </code></pre>
  
  <p>I think my mistake is I plug the formula straight into the <code>'values'</code>. But I really hope it can calculate the value of <code>rmse_</code> when I assign the value of <code>Hidden Layer 1</code>, <code>Hidden Layer 2</code>, and <code>Threshold Level</code>. Which part should I change? Can anyone give me some hints? Or I have used the wrong function already? </p>
  
  <p>I am sorry if the way I ask is a little bit inappropriate. Because I am new to <code>R</code>, can anyone give me some tips about how to do it? I tried my best, and I am not sure whether I am on the right path or not.</p>