R shiny reactive table, render plot can not work <p>everyone. I am very new to shiny. I would like to plot a pie chart based on a filter data frame. Here is my data frame:</p> <pre><code>Duration Received Name Status 1 month 01/14/2014 Tim Completed 1 month 02/12/2014 Chris Completed 2 months 01/08/2015 Anna Completed 1 month 06/25/2014 Jenifer Completed 2 months 05/14/2015 Ruby Completed more than 3 months 11/05/2014 David Pending 2 months 05/12/2015 Anna Completed 1 months 03/26/2015 David Completed ... ... </code></pre> <p>There may be more than 500 lines in the data frame</p> <p>First, I tried to subset the data frame by Received Date. And plot the Duration Freq in pie chart. For example, I would like to choose all records after 12/31/2014. So I can select my Received Date. Then, table() Duration column in the subset data frame. Last, plot the pie chart.</p> <p>My problem is when I change the date Rang of the Received date, my pie plot keep the consistent, never update. Can anyone help me to debug my script and tell me why? Thank you</p> <p>Here is my code: ui.R</p> <pre><code>library(shiny) library(ggplot2) ggpie &lt;- function (dat, by, totals) { ggplot(dat, aes_string(x=factor(1), y=totals, fill=by)) + geom_bar(stat='identity', color='black') + guides(fill=guide_legend(override.aes=list(colour=NA))) + coord_polar(theta='y') + theme(axis.ticks=element_blank(), axis.text.y=element_blank(), axis.text.x = element_blank(), axis.title=element_blank()) + scale_y_continuous(breaks=cumsum(dat[[totals]]) - dat[[totals]] / 2, labels=dat[[by]]) } shinyUI(fluidPage( headerPanel("My App"), sidebarPanel( dateRangeInput("dates", label = h3("Received Date Range"), start = "2013-01-01", end = as.character(Sys.Date()) ) ), mainPanel( plotOutput("Duration"), tableOutput("test") ) )) </code></pre> <p>server.R</p> <pre><code>library(shiny) library(ggplot2) ggpie &lt;- function (dat, by, totals) { ggplot(dat, aes_string(x=factor(1), y=totals, fill=by)) + geom_bar(stat='identity', color='black') + guides(fill=guide_legend(override.aes=list(colour=NA))) + coord_polar(theta='y') + theme(axis.ticks=element_blank(), axis.text.y=element_blank(), axis.text.x = element_blank(), #axis.text.x=element_text(colour='black',angle=45, size=10, vjust=0.5), axis.title=element_blank()) + scale_y_continuous(breaks=cumsum(dat[[totals]]) - dat[[totals]] / 2, labels=dat[[by]]) } shinyServer(function(input, output) { #table newData= reactive({ data1 = subset(data, input$dates[1]&lt;=data$Received &amp;&amp; data$Received&lt;=input$dates[2]) data2 = as.data.frame(table(data1$Duration)) }) output$test&lt;- renderTable({ newData() }) output$Duration&lt;-renderPlot({ ggpie(newData(), by='Var1', totals="Freq") + ggtitle("Duration")+ scale_fill_discrete(name="Duration") }) }) </code></pre>