title: How to make datatable editable in R shiny
body: <p>I am creating R shiny app, I am not sure how to make my datatable editable of rows and columns in R shiny. As I tried using <code>renderDT=(editable = TRUE)</code> from the package DT, but it didn't work. Could someone please show me how to do this in R shiny?</p>
  <p>If  I am wrong then where I should possibly set <code>editable =TRUE</code> to make the datatable editable</p>
  <p><strong>CSV</strong></p>
  <pre><code>ID  Type   Range
  21  A1 B1   100
  22  C1 D1   200
  </code></pre>
  <p><strong>App.R</strong></p>
  <pre><code>library(shiny)
  library(reshape2)
  library(DT)
  library(tibble)
  
  
  ###function for deleting the rows
  splitColumn &lt;- function(data, column_name) {
    newColNames &lt;- c(&quot;Unmerged_type1&quot;, &quot;Unmerged_type2&quot;)
    newCols &lt;- colsplit(data[[column_name]], &quot; &quot;, newColNames)
    after_merge &lt;- cbind(data, newCols)
    after_merge[[column_name]] &lt;- NULL
    after_merge
  }
  ###_______________________________________________
  ### function for inserting a new column
  
  fillvalues &lt;- function(data, values, columName){
    df_fill &lt;- data
    vec &lt;- strsplit(values, &quot;,&quot;)[[1]]
    df_fill &lt;- tibble::add_column(df_fill, newcolumn = vec, .after = columName)
    df_fill
  }
  
  ##function for removing the colum
  
  removecolumn &lt;- function(df, nameofthecolumn){
    df[ , -which(names(df) %in% nameofthecolumn)]
  }
  
  ### use a_splitme.csv for testing this program
  
  ui &lt;- fluidPage(
    sidebarLayout(
      sidebarPanel(
        fileInput(&quot;file1&quot;, &quot;Choose CSV File&quot;, accept = &quot;.csv&quot;),
        checkboxInput(&quot;header&quot;, &quot;Header&quot;, TRUE),
        actionButton(&quot;Splitcolumn&quot;, &quot;SplitColumn&quot;),
        uiOutput(&quot;selectUI&quot;),
        actionButton(&quot;deleteRows&quot;, &quot;Delete Rows&quot;),
        textInput(&quot;textbox&quot;, label=&quot;Input the value to replace:&quot;),
        actionButton(&quot;replacevalues&quot;, label = 'Replace values'),
        actionButton(&quot;removecolumn&quot;, &quot;Remove Column&quot;),
        actionButton(&quot;Undo&quot;, 'Undo')
      ),
      mainPanel(
        DTOutput(&quot;table1&quot;)
      )
    )
  )
  
  server &lt;- function(session, input, output) {
    rv &lt;- reactiveValues(data = NULL, orig=NULL)
    
    observeEvent(input$file1, {
      file &lt;- input$file1
      ext &lt;- tools::file_ext(file$datapath)
      
      req(file)
      
      validate(need(ext == &quot;csv&quot;, &quot;Please upload a csv file&quot;))
      
      rv$orig &lt;- read.csv(file$datapath, header = input$header, )
      rv$data &lt;- rv$orig
    })
    
    output$selectUI&lt;-renderUI({
      req(rv$data)
      selectInput(inputId='selectcolumn', label='select column', choices = names(rv$data))
    })
    
    
    observeEvent(input$Splitcolumn, {
      rv$data &lt;- splitColumn(rv$data, input$selectcolumn)
    })
    
    observeEvent(input$deleteRows,{
      if (!is.null(input$table1_rows_selected)) {
        rv$data &lt;- rv$data[-as.numeric(input$table1_rows_selected),]
      }
    })
    
    output$table1 &lt;- renderDT({
      rv$data
    })
    observeEvent(input$replacevalues, {
      rv$data &lt;- fillvalues(rv$data, input$textbox, input$selectcolumn)
    })
    observeEvent(input$removecolumn, {
      rv$data &lt;- removecolumn(rv$data,input$selectcolumn)
    })
    observeEvent(input$Undo, {
      rv$data &lt;- rv$orig
    })
  }
  
  shinyApp(ui, server)
  </code></pre>