Creating regularly spaced time series from irregular one
Firstly, don't cross-post. Second, take a look at the archives on both these lists for answers to your questions. 'its' is rather old, and not where you want to be looking. Take a look at xts for fast time-series manipulation like you need, specifically to.period, endpoints, and align.time. There is a wealth of documentation in the package, in the vignette, and even online in more than a few places, but you can start here: http://cran.r-project.org/web/packages/xts/vignettes/xts.pdf http://www.quantmod.com/examples/data/ Also zoo for na.locf etc. Additional options include the fts package and timeSeries. HTH Jeff On Mon, Feb 22, 2010 at 2:52 PM, Ivan Kalafatic
<ivan.kalafatic at gmail.com> wrote:
Hello, I have a series of intraday (high-frequency) price data in the form of POSIX timestamp followed by the value. I sucesfuly loaded that into "its" package object. I would like to create from it a regularly spaced time series of prices (for example 1min, 5min, etc apart) so i could calcualte returns. There is an interpolation function locf() that for timestamp with value NA uses last known observation. I guess the idea would be to start from the begining of my series and, for example, if there is no timestamp for t+5min add that time with value NA. Than I could use locf() function to fill those NAs. Finaly I should extract from that series, series with 5min spaced timestamps with prices. Appart from applying locf() function, I have no idea how to add NAs into original series or extract the regular series after. Can someone help me with this? Thank you. ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com