title: R, Shiny, DT table, replacing data
body: <p>I'm trying to be able to edit a table through a text input followed by an action button. In addition, I'd like the data to stay changed, so that if I reload the app or enter in new data into the text input, the previous input doesn't revert to the previous value. </p>
  
  <p>I feel like there is likely a simple way to do this, and I see things like this, where we can delete rows: <a href="https://stackoverflow.com/questions/44751915/are-table-displayed-on-shiny-read-only">Are table displayed on shiny,read only?</a> But that wouldn't help for when you reload the app. In addition, I don't seem quite able to apply it to just changing a specific cell.</p>
  
  <p>Below I have some simplified code, using mtcars. I added two columns, one giving a Car number, and one for if the car is good. So essentially, I would like to be able to enter 1, then row Car_number 1 will have Good_car column changed to True. Then, when I enter 2, I'd like for both the previous 1 and now 2 to also be True. And finally, next time I reload the app I want them to still be True.</p>
  
  <p>The second data table  is just showing that I know the dplyr mutate replace can change specific things in a data table, because when I enter the car number using that it will change Good_car to T for that number, until the input changes then it will revert back. </p>
  
  <pre><code>library(shiny)
  library(dplyr)
  library(DT)
  
  mtbetter&lt;-mtcars%&gt;%
    mutate(Car_number = c(1:32),
           Good_car = F)
  
  
  ui &lt;- fluidPage(
        textInput(inputId = "text", label = "Filter Car Number"),
        actionButton("action", "Go!"),
        dataTableOutput(outputId = "table"),
        dataTableOutput(outputId = "table2")
  )
  
  server = function(input, output, session){
    mtfinal = reactiveVal(mtbetter)
  
    output$table&lt;-renderDataTable({
      mtfinal()
      })
    observeEvent(input$action, {mtfinal()%&gt;%
        mutate(Good_car = replace(Good_car, Car_number == input$text, T))})
  
    output$table2&lt;-renderDataTable({
  
      mtbetter2&lt;-mtbetter%&gt;%
        mutate(Good_car = replace(Good_car, Car_number == input$text, T))
  
      mtbetter2
  
    })
  
  }
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>I also suspect that Replacedata will do it, but admittedly the documentation still can go over my head sometimes: <a href="https://rdrr.io/cran/DT/man/replaceData.html" rel="nofollow noreferrer">https://rdrr.io/cran/DT/man/replaceData.html</a> </p>