[R-SIG-Finance] Irregular time series and tick data
jeff.a.ryan at gmail.com
Sat Apr 16 03:35:34 CEST 2011
Again, searching the list is the best bet - especially as I am replying via phone at this point and can't provide the full examples I'd like to.
In general, you need to do something like as.POSIXct(paste(date,time)), which should work for the example data you posted. That gets you a proper time based object for xts.
Jeffrey Ryan | Founder | jeffrey.ryan at lemnica.com
On Apr 15, 2011, at 7:52 PM, Noah Silverman <noah at smartmediacorp.com> wrote:
> I currently have date and time in two columns. How would I coerce that into a proper timestamp for xts?
> Noah Silverman
> Smart Media Corp.
> Tel: (323) 653-1900 x5207
> On Apr 15, 2011, at 5:36 PM, Jeff Ryan wrote:
>> Hi Noah.
>> Take a look through the list archives, you'll find this is a very common question.
>> My (biased) reply is use xts. Highly optimized for tick data, very fast (mostly C) and widely used/depended upon.
>> Aside from that, zoo is stellar - though might be tougher with tick data and will also complain about duplicate times.
>> fts and timeSeries are quite good as well, though different (fts is actually a wrapper to a C++ library by the same author). timeSeries is part of rmetrics, and is nice, though not really built for big/high freq data.
>> ts, its, irts, are really quite old and exist only for particular legacy reasons best I can tell.
>> data.table isn't a time series per se, but is quite a cool replacement for data.frames.
>> Check the list (as recently as the last few posts even!), and give them all a test - that's the best part of OSS.
>> Jeffrey Ryan | Founder | jeffrey.ryan at lemnica.com
>> On Apr 15, 2011, at 6:32 PM, Noah Silverman <noah at smartmediacorp.com> wrote:
>>> I have some tick data that I want to analyze.
>>> The file given to me has date and time in separate columns.
>>> There may be multiple transactions with the same date and time stamps
>>> I tried using the its package to convert them into a nice time series object, but it complains about multiple items with the same index.
>>> Does anyone have any guidance as to how to best do this in R??
>>> Below are a few lines of the data
>>> symbol as_of_date as_of_time close_price volume
>>> 1 WCH07 2007-01-01 18:32:01 882.50 20
>>> 2 WCH07 2007-01-01 18:32:01 882.50 5
>>> 3 WCH07 2007-01-01 18:32:06 882.75 2
>>> 4 WCH07 2007-01-01 18:32:06 883.00 1
>>> 5 WCH07 2007-01-01 18:32:06 883.00 2
>>> 6 WCH07 2007-01-01 18:32:07 883.00 1
>>> R-SIG-Finance at r-project.org mailing list
>>> -- 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.
More information about the R-SIG-Finance