title: In shiny How to create a DT table, where i can add rows and delete the rows simultaneously
body: <p>I have tried this in different ways and achieved one task, either add or delete., but i couldn't get complete solution in one, i might be missing some small concept somewhere.. I am adding the code , please help me complete my basic app.</p>
  
  <pre><code>library(shiny)
  library(DT)
  x&lt;- data.frame(v1 = NA,
           v2 = NA
  
  ),
  ui = shinyUI(
   fluidPage(
    sidebarLayout(
      sidebarPanel(
        textInput("v1","v1","a"),
        numericInput("V2","V2","1"),
        # Row selection
        numericInput(inputId = "row.selection", label = "Select row to be 
   deleted", min = 1, max = 100, value = "")
        # Add button
        actionButton(inputId = "add.button", label = "Add", icon = 
   icon("plus")), 
        # Delete button 
        actionButton(inputId = "delete.button", label = "Delete", icon = 
   icon("minus")),
  
      ),
      mainPanel(
        dataTableOutput('table')
      )
    )
   )
  ),
  </code></pre>
  
  <p>Server side code  </p>
  
  <pre><code>server = function(input, output, session) {
    values &lt;- reactiveValues()
    values$df &lt;- x
  
    newEntry &lt;- observe({
      cat("newEntry\n")
      if(input$add.button &gt; 0) {
        newRow &lt;- data.frame(input$v1, input$v2)
        isolate(values$df &lt;- rbind(values$df,newRow))
     }
    })
  
    deleteEntry &lt;- observe({
     cat("deleteEntry\n")
     if(input$delete.button &gt; 0) {
       if(is.na(isolate(input$row.selection))){
         values$df &lt;- isolate(values$df[-nrow(values$df), ])
       } else {
         values$df &lt;- isolate(values$df[-input$row.selection, ])
       }
     } 
  
    })
  
    output$table = renderDataTable({
      values$df 
  
    })
  
  }
  </code></pre>