[R-SIG-Finance] [R-sig-finance] Importing intra day data

Jeff Ryan jeff.a.ryan at gmail.com
Fri Aug 7 16:28:38 CEST 2009


The answer lies in the error:


> 07/01/1998,14:15:00,12.94,12.94,12.94,12.94,600
>
> I think I am having trouble converting the data to xts type, due to the date
> and time fields being contained in seperate variables.
>
>> EWW.xts <- as.xts(EWW)
> Error in as.POSIXlt.character(x, tz, ...) :
>  character string is not in a standard unambiguous format
>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/01/1998 is ambiguous, and not ISO 8601.
http://en.wikipedia.org/wiki/ISO_8601

CCYY-MM-DD would be correct, and CCYY-MM-DD HH:MM:SS is preferred.

try something like:

> xts(EWW[,-c(1,2)], as.POSIXct(strptime(paste(EWW$Date,EWW$Time),"%m/%d/%Y %H:%M:%S")))
                     Open  High   Low Close Volume
1998-07-01 10:07:00 12.63 12.63 12.63 12.63    500
1998-07-01 10:27:00 12.75 12.75 12.75 12.75    100
1998-07-01 10:29:00 12.75 12.75 12.75 12.75    100
1998-07-01 11:07:00 12.75 12.75 12.75 12.75    100
1998-07-01 13:49:00 12.75 12.75 12.75 12.75   1000
1998-07-01 14:15:00 12.94 12.94 12.94 12.94    600

HTH
Jeff



> Has anyone come across a similar problem before?
>
> Thanks,
> Eduard
>
> --
> View this message in context: http://www.nabble.com/Importing-intra-day-data-tp24864718p24864718.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> 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.
>



-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list