[R-SIG-Finance] convert ordered but non-unique csv to unique xts

dae dougedmunds at gmail.com
Thu May 9 23:00:09 CEST 2013


The csv file has ordered data but does not provide microseconds. 
There are entries with the same datetime  (to the seconds level) which
are in the proper sequential order.

I want to convert the file into an xts object with unique time values 
(by adding microseconds), if that can be done.
I am stuck for what steps to take, starting from the csv file.

Example data from csv file (note that four entries all have same datetime):

Time,High,Low,Open,Close,Vol
2013/05/08 08:02:04,6.35,6.345,6.35,6.345,172
2013/05/08 08:02:07,6.345,6.3425,6.345,6.3425,69
2013/05/08 08:02:07,6.3425,6.34,6.3425,6.34,74
2013/05/08 08:02:07,6.3425,6.34,6.34,6.3425,80
2013/05/08 08:02:07,6.345,6.3425,6.3425,6.345,87
2013/05/08 08:02:13,6.345,6.3425,6.345,6.3425,110

Goal; an xts object something like this 
(however the microseconds may appear):

                                          High,Low,Open,Close,Vol
2013-05-08 08:02:04.000,6.35,6.345,6.35,6.345,172
2013-05-08 08:02:07.001,6.345,6.3425,6.345,6.3425,69
2013-05-08 08:02:07.002,6.3425,6.34,6.3425,6.34,74
2013-05-08 08:02:07.003,6.3425,6.34,6.34,6.3425,80
2013-05-08 08:02:07.004,6.345,6.3425,6.3425,6.345,87
2013-05-08 08:02:13.000,6.345,6.3425,6.345,6.3425,110

Any help greatly appreciated. Thanks.



--
View this message in context: http://r.789695.n4.nabble.com/convert-ordered-but-non-unique-csv-to-unique-xts-tp4666712.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list