[R-SIG-Finance] non-standard time-format conversion from data.frame to xts

Brian G. Peterson brian at braverock.com
Wed Dec 8 15:24:15 CET 2010


On 12/08/2010 08:02 AM, Andres Susrud wrote:
> Hi,
>
> I have a conversion problem from data.frame to xts.
>
> my dataset looks like this
>> data[1:5,]
>          Time   Bid  Offer
> 1 7:10:03 AM 6118.5 6119.5
> 2 7:10:36 AM 6118.5 6119.5
> 3 7:11:07 AM 6119.5 6119.5
> 4 7:11:48 AM 6119.0 6120.0
> 5 7:12:25 AM 6119.0 6119.5
>
> Because of the lack of date, and the time format of H,M,S and AM/PM, I can't
> convert via as.xts or as.zoo etc.
>
> any suggestions?

I assume that you know the date...

given that, you will change your format string (see ?strftime )
to something like

format='2010-12-08 %I:%M:%S %p'

Next time, please use dput() for your example data, and construct a 
self-contained example.

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list