Created
May 30, 2017 06:43
-
-
Save aagarw30/4f10bad8aa94d47e024934350c16f2b8 to your computer and use it in GitHub Desktop.
Delete specific rows from data frame using reactiveValues() - example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyServer((function(input, output) { | |
values <- reactiveValues(df = NULL) | |
observeEvent(input$file, { | |
values$df <- read.csv(input$file$datapath) | |
}) | |
observeEvent(input$delete, { | |
values$df <- values$df[-input$rowno, ] | |
}) | |
output$new_df <- renderTable(values$df) | |
})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyUI((fluidPage( | |
"Delete specific rows from dataframe using reactiveValues() - example", | |
br(), | |
mainPanel( | |
fileInput("file", "Upload file"), | |
numericInput("rowno", "Delete row:", 1, step = 1), | |
actionButton("delete", "Delete this row"), | |
tableOutput("new_df") | |
) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment