[R-SIG-Finance] reading high frequency data

Enrico Schumann es at enricoschumann.net
Sun Aug 3 14:07:14 CEST 2014


On Sun, 03 Aug 2014, jun wang <junluke at gmail.com> writes:

> Dear All,
>
> I am trying to read some high frequency data using "read.zoo", but keeping
> getting some errors. Any help/suggestions would be really appreciated.
> Below is a sample of my data and the error message i am getting:
>
>
>   date time Last Price  06/20/2014 3:30:00 1962.48  06/20/2014 3:35:00
> 1962.2  06/20/2014 3:40:00 1961.67  06/20/2014 3:45:00 1962.18  06/20/2014
> 3:50:00 1962.9  06/20/2014 3:55:00 1962.35  06/20/2014 4:00:00 1962.4
> 06/20/2014 4:05:00 1962.24
>
> fmt <- "%m/%d/%Y %H:%M:%S"
> z <- read.zoo("sp_hf.csv",header=TRUE,index=1:2, tz = "", format = fmt)
>
> *Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
>  : *
> *  line 1 did not have 2 elements*


Please read the posting guide:
http://www.r-project.org/posting-guide.html -- Your example is not
reproducible, so we can only guess.  Your data seems to use space as a
delimiter (despite your reading a "csv" file), so try replacing "Last
Price" with "Last_Price" or skipping the header line altogether.


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net



More information about the R-SIG-Finance mailing list