Re: [R] Query about creating time sequences

2012-05-27 Thread R. Michael Weylandt
Depending on your exchange of interest, you might also find some of the functions of the timeDate package helpful, e.g., holidayNYSE() -- it will miss the day the market was closed for extraordinary circumstances, but it seems to do a very good job. [Disclaimer: I haven't used it myself extensively

Re: [R] Query about creating time sequences

2012-05-27 Thread Gabor Grothendieck
On Sun, May 27, 2012 at 8:01 PM, Shivam 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 t

Re: [R] Query about creating time sequences

2012-05-27 Thread Shivam
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

Re: [R] Query about creating time sequences

2012-05-27 Thread Gabor Grothendieck
On Sun, May 27, 2012 at 7:03 PM, Shivam wrote: > Thanks for the responses ppl. > > @Gabor - The issue with your approach was that I had to select the time > window for many days (124), which would be very difficult to achieve. I > really appreciate you time though. Why does the number of days "ma

Re: [R] Query about creating time sequences

2012-05-27 Thread Shivam
Thanks for the responses ppl. @Gabor - The issue with your approach was that I had to select the time window for many days (124), which would be very difficult to achieve. I really appreciate you time though. @Jeff - Your solution works. I had to tweak it a little as I needed the sequence for eac

Re: [R] Query about creating time sequences

2012-05-27 Thread Jeff Newmiller
Try this: # Setting TZ is optional, but I find it helps me to be more aware of # timezone effects Sys.setenv( TZ="Asia/Kolkata") library(lubridate) pdates <- as.POSIXct( fdates ) hstart <- new_period( hour=9, minute=15 ) hend <- new_period( hour=15, minute=30 ) mperiod <- new_period( minute=15

Re: [R] Query about creating time sequences

2012-05-27 Thread Gabor Grothendieck
On Fri, May 25, 2012 at 1:14 PM, Shivam wrote: > Hi All, > > I have a query about time based sequences. I know such questions have been > asked a lot on forums, but I couldnt find the exact thing that I was > looking for. > > I want to create a time-based sequence which will mimic the trading wind

Re: [R] Query about creating time sequences

2012-05-27 Thread Shivam
Thanks for the effort Michael, but the problem here is that the dates for which the sequences need to be created have gaps in between. Basically I need the sequence for only those days on which the security market is open (I have the dates in a file which is present at the end of THIS mail). What

Re: [R] Query about creating time sequences

2012-05-25 Thread R. Michael Weylandt
One (somewhat kludgy) way would be to use seq() to make one day's worth of times then to pass those to outer() to add in the needed days and then coerce the whole thing back to a sorted vector. I'm not at a computer right now so this won't be quite right but something like x <- seq(x.start.fi

[R] Query about creating time sequences

2012-05-25 Thread Shivam
Hi All, I have a query about time based sequences. I know such questions have been asked a lot on forums, but I couldnt find the exact thing that I was looking for. I want to create a time-based sequence which will mimic the trading window AND would span multiple days. Something like below: "201