The actual source of the problem ended up being my data type conversion. The time was not being included in the conversion for large datasets. I defined the format with esheet$DateTime<-as.POSIXlt(esheet$DateTime,format="%Y-%m-%d %H:%M") and my subsetting worked within the loop.