Location and value for consecutive values above threshold
library(zoo)
# Get the index value
xx <- which(rollapply(eg$avg,4, function(x) min(x))>17)[1]
# Get the date
eg$date[xx]
library(zoo)
# Get the index value
xx <- which(rollapply(eg$avg,4, function(x) min(x))>17)[1]
# Get the date
eg$date[xx]