Streamline R code for Shiny usage
Changed a little bit input data:

n &lt;- 60
set.seed(21)
a &lt;- data.frame(
  DATE = 
    rev(seq.Date(as.Date("2018-01-01"), as.Date("2018-06-15"), "days"))[1:n],
  OPERATION_STATUS = sample(c("PASS","FAIL"), n, replace = TRUE),
  CRIT_CODE = sample(c("A", "B", "C"), n, replace = TRUE)
)


Using data.table I would do it like this:

require(data.table)
setDT(a)  
a[, group_i := DATE &gt;= (Sys.Date() - 30)]
rates3 &lt;- a[, .(
  Percent1 = round(sum(OPERATION_STATUS == 'FAIL') / .N * 100, 2),
  Percent2 = round(sum(OPERATION_STATUS[group_i] == 'FAIL') / sum(group_i) * 100, 2)
  ),
  keyby = CRIT_CODE]

rates3
#    CRIT_CODE Percent1 Percent2
# 1:         A    71.43    75.00
# 2:         B    63.16    66.67
# 3:         C    59.26    45.45


Presumably for large data one of the fastest approaches. 

P.S. results changes depending on Sys.Date()

Names can be added directly:

rates3 &lt;- a[, .(
  'Overall Percent' = round(sum(OPERATION_STATUS == 'FAIL') / .N * 100, 2),
  '30 Day Percent' = round(sum(OPERATION_STATUS[group_i] == 'FAIL') / sum(group_i) * 100, 2)
  ),
  keyby = .(Area = CRIT_CODE)]