title: Object 'xxx' not found while deploying random forest in Shiny app
body: <p>Sorry if it has been asked before. I try to deploy my random forest model to shiny app. but when I try, it says &quot;Object'Region' not found.
  I'm not sure what is wrong. I also wonder how to make a print of predicted test set in R.
  I really highly appreciate any help. Thank you ver much!
  <a href="https://i.stack.imgur.com/QEMdG.png" rel="nofollow noreferrer">enter image description here</a>
  Here's my code.</p>
  <pre><code>library(shiny)
  library(data.table)
  library(randomForest)
  library(DT)
  
  # Read in the RF model
  model &lt;- readRDS(&quot;ModelRF.rds&quot;)
  
  # User interface                   
  
  ui &lt;- pageWithSidebar(
    
    # Page header
    headerPanel('Flood Predictor'),
    
    # Input values
    sidebarPanel(
      #HTML(&quot;&lt;h3&gt;Input parameters&lt;/h3&gt;&quot;),
      tags$label(h3('Input parameters')),
      
      numericInput(&quot;RR&quot;, 
                   label = &quot;Daily Rainfall&quot;, 
                   value = 13),
      numericInput(&quot;Forest_Ratio&quot;, 
                   label = &quot;Forest Ratio&quot;, 
                   value = 0.59),
      numericInput(&quot;Streamflow&quot;, 
                   label = &quot;Streamflow&quot;, 
                   value = 9.97),
      
      
      actionButton(&quot;submitbutton&quot;, &quot;Submit&quot;, 
                   class = &quot;btn btn-primary&quot;)
    ),
    
    mainPanel(
      tags$label(h3('Status/Output')), # Status/Output Text Box
      verbatimTextOutput('contents'),
      tableOutput('tabledata') # Prediction results table
      
    )
  )
  
  
  # Server                           
  server&lt;- function(input, output, session) {
    
    # Input Data
    datasetInput &lt;- reactive({  
      
      df &lt;- data.frame(
        Name = c(
                 &quot;Daily Rainfall&quot;,
                 &quot;Forest Ratio&quot;,
                 &quot;Streamflow&quot;),
        Value = as.character(c(input$RR,
                               input$Forest_Ratio,
                               input$Streamflow)),
        stringsAsFactors = FALSE)
      
      Flood &lt;- 0
      df &lt;- rbind(df, Flood)
      input &lt;- transpose(df)
      write.table(input,&quot;input.csv&quot;, sep=&quot;,&quot;, quote = FALSE, row.names = FALSE, col.names = FALSE)
      
      test &lt;- read.csv(paste(&quot;input&quot;, &quot;.csv&quot;, sep=&quot;&quot;), header = TRUE)
      
      Output &lt;- data.frame(Prediction=predict(model,test), round(predict(model,test,type=&quot;prob&quot;), 3))
      print(Output)
      
    })
    
    # Status/Output Text Box
    output$contents &lt;- renderPrint({
      if (input$submitbutton&gt;0) { 
        isolate(&quot;Calculation complete.&quot;) 
      } else {
        return(&quot;Server is ready for calculation.&quot;)
      }
    })
    
    # Prediction results table
    output$tabledata &lt;- renderTable({
      if (input$submitbutton&gt;0) { 
        isolate(datasetInput()) 
      } 
    })
    
  }
  
  
  # Create the shiny app             
  shinyApp(ui = ui, server = server)
  
  </code></pre>