I have a code (similar to another post) Insert a numeric input for each row - R Shiny that generates editable renderTable with existing values from a data frame. Now I want to save the updated values into the same data frame after editing the values. How do I do that?
shiny::runApp(list(
ui = basicPage(
tableOutput("My_table")
),
server = function(input, output, session) {
My_table = matrix(
c(1:100),
nrow=20,
ncol=5)
output$My_table <- renderTable({
input1 <- paste0("<input id='a", 1:nrow(My_table), "'"," value='",My_table[,1],"'" ," class='shiny-bound-input' type='character' style='width: 50px;'>")
input2 <- paste0("<input id='b", 1:nrow(My_table), "'"," value='",My_table[,5],"'" ," class='shiny-bound-input' type='number' style='width: 50px;'>")
cbind(input1, My_table[,c(2,3,4)], input2)
}, sanitize.text.function = function(x) x)
}
))
Any help would be appreciated. Thanks.