Thank you for your responses but I think whith some examples the problem will be better understated. Ok, here it is an example of how the data looks like to allow a better understanding of the problem.
Dframe1 <- data.frame(sunrise = seq(as.POSIXct("2010-07-14 06:05:25"),as.POSIXct("2010-07-20 06:05:25"),by="day"),sunset= seq(as.POSIXct("2010-07-14 18:00:00"),as.POSIXct("2010-07-20 18:00:00"),by="day")) Dframe2 <- data.frame(Logtime = seq(as.POSIXct("2010-07-14 06:05:25"),as.POSIXct("2010-07-20 06:05:25"),by="hour"), temp = runif(145, -5, 15)) What I’m interested on is rows from the Dframe2 during the day, and for that I need (I think) a loop to see if each Logtime occurred during the day or night. Cheers Patrao -- View this message in context: http://r.789695.n4.nabble.com/Loop-to-find-dates-whithin-dates-tp3264180p3264540.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.