I am looking to find a way to add a button to a datatable in r shiny that: Adds an empty column to the data table each time it is clicked (and dataframe that made the table in the first place Which the user can fill himself With numeric or text values And set their own column name to describe the type of entry values.
To for instance add lab note records to instrument data that is already in the shiny app manually
I am asking in case a more skilled person who has a better clue than me knows how to do this. I have read a bunch of pages, but at best the example I found provides 1 fixed empty column with a fixed name
A dummy table from the package : library(DT)
ui <- basicPage(
h2("The mtcars data"),
DT::dataTableOutput("mytable")
)
server <- function(input, output) {
output$mytable = DT::renderDataTable({
mtcars
})
}
shinyApp(ui, server)
You can use a button to add a new column to a R shiny datatable like this:
If you also need to edit the contents of the cells interactively, you can use
renderRHandsontable
instead ofrenderDataTable
. Like this: