How to use multiple action buttons in R Shiny to manipulate a data frame consecutively?
<p>I am trying to build a Shiny App with 4 action buttons that manipulate 1 data frame. I tried to make my action buttons working on the data frame consecutively, say, by clicking the <strong>Delete The First Row</strong> 49 times and I can get the last row of <code>cars</code>. I've written a ui.R for that:</p>

<pre><code>#ui.R
shinyUI(pageWithSidebar(
  headerPanel("actionButton test"),
  sidebarPanel(
    actionButton("delete_top_1", "Delete The First Row"),
    p("Click the button to delete the first row"),
    #cars[-1, ]
    br(),
    actionButton("delete_last_1", "Delete the Last Row"),
    p("Click the button to delete the last row"),
    #cars[-nrow(cars), ]
    br(),
    actionButton("delete_top_2", "Delete the Top 2 Rows"),
    p("Click the button to delete the top 2 rows"),
    #cars[-1:-2, ]
    br(),
    actionButton("delete_last_2", "Delete the Last 2 Rows"),
    p("Click the button to delete the last 2 rows")
    #cars[-nrow(cars):-(nrow(cars)-1), ]
  ),
  mainPanel(
    tableOutput('view')
  )
))
</code></pre>

<p>However, I am stuck with the server.R part, I am thinking about using a <code>reactiveValue()</code> to replace <code>cars</code>. Could someone give me sample codes on the server.R part? </p>