Here is a suggestion:
# Create data
library(lubridate)
set.seed(50)
myDates <- ymd("2013-07-12") + days(sample(1:100, 20))
df <- data.frame(date=as.Date(myDates), value=sample(1:100, 20))
df[sample(1:20, 5, replace=F), "value"] <- NA
# date value
# 1 2013-09-21 NA
# 2 2013-08-25 NA
# 3 2013-08-01 70
# 4 2013-09-25 82
# 5 2013-08-31 30
# 6 2013-07-17 NA
# 7 2013-09-16 55
# 8 2013-09-11 NA
# 9 2013-07-16 96
# 10 2013-07-22 34
# 11 2013-08-17 33
# 12 2013-08-06 37
# 13 2013-09-07 39
# 14 2013-07-19 54
# 15 2013-08-05 99
# 16 2013-09-08 NA
# 17 2013-10-20 11
# 18 2013-08-12 59
# 19 2013-10-07 31
# 20 2013-07-26 38
# Proposed solution
myQtle <- quantile(as.POSIXlt(df$date), probs = 0.25 * 1:4)
myCumVal <- sapply(myQtle,
function(qtle, theDates, theValues){
sum(is.na(theValues[theDates <= qtle]))},
theDates = as.POSIXlt(df$date),
theValues = df$value)
data.frame(qtle = as.Date(myQtle),
nb.na = c(myCumVal[1], diff(myCumVal)))
# qtle nb.na
# 25% 2013-07-30 1
# 50% 2013-08-21 0
# 75% 2013-09-12 3
# 100% 2013-10-20 1