On Sun, May 27, 2012 at 8:01 PM, Shivam <shivamsi...@gmail.com> wrote: > Its not the number of days per se, it is the random gaps between the dates > (corresponding to the dates on which the security market was closed) which > will be difficult to accommodate in the solution proposed by you. So I would > have to remove the sequence corresponding to those days from the entire > sequence. This was the part which I deemed as difficult to achieve. > I had mentioned this issue in my previous mails but you might have missed > it. >
If dd is a vector of the dates you want then just change the last line to choose only those using as.Date(tseq, tz = "") %in% dd as below: dd <- as.Date(c("2011-01-03", "2011-01-04")) ## from <- as.POSIXct(paste(dd[1], "09:15:00")) ## to <- as.POSIXct(paste(tail(dd, 1), "15:30:00")) ## tseq <- seq(from, to, "1 min") tt <- format(tseq, "%H:%M:%S") tresult <- tseq[tt >= "09:30:00" & tt <= "15:30:00" & as.Date(tseq, tz = "") %in% dd] ## -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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.