title: How to link selectInput() which contains number choices to reactive dataset?
body: <p>I am not able to link the UI selectInput() which number choices from 1 to 50 for column heads to the reactive dataset. Every other part of the below code works fine except for this one,</p>
  
  <p>temp3[,input$col_num]&lt;-as.factor(temp3[,input$col_num])</p>
  
  <p>it says Error in [.data.frame: undefined columns selected. Below is the code,</p>
  
  <pre><code> both_na&lt;-reactive({
  
  
     source("D:/Documents/R_Projects/Data_Camp_Tutorials/
     ML_Tree_App/functions.R")
    file1&lt;-input$file
     temp3&lt;-read.csv(file=file1$datapath, sep=input$sep, 
                  header = input$header, stringsAsFactors = 
     input$stringAsFactors)
     # create logical set for numeric columns
     temp3[,input$col_num]&lt;-as.factor(temp3[,input$col_num])
     temp3[,sapply(temp3,is.numeric)]&lt;- 
     lapply(temp3[,sapply(temp3,is.numeric)], function(x) replace(x, is.na(x), 
     mean(x[!is.na(x)])))
     temp3[,!sapply(temp3,is.numeric)]&lt;- 
      lapply(temp3[,!sapply(temp3,is.numeric)], function(x) replace(x, 
       is.na(x), Mode(x[!is.na(x)])))
       temp3
       })    
  </code></pre>