Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(shiny)
- library(dplyr)
- library(DT)
- mtbetter<-mtcars%>%
- mutate(Car_number = c(1:32),
- Good_car = F)
- ui <- 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<-renderDataTable({
- mtfinal()
- })
- observeEvent(input$action, {mtfinal()%>%
- mutate(Good_car = replace(Good_car, Car_number == input$text, T))})
- output$table2<-renderDataTable({
- mtbetter2<-mtbetter%>%
- mutate(Good_car = replace(Good_car, Car_number == input$text, T))
- mtbetter2
- })
- }
- shinyApp(ui, server)
Add Comment
Please, Sign In to add comment