[R-SIG-Finance] Don't success to create xts from lines in code
pierre8r-list at yahoo.fr
pierre8r-list at yahoo.fr
Thu Jul 24 20:59:38 CEST 2008
Hi Josh,
Thanks, it works.
If it don't boring you, I want to read a other data format.
There is a comma between Date and Time.
2008.07.14,04:00,1.5894,1.5916,1.5893,1.5914,276
2008.07.14,05:00,1.5912,1.5912,1.5902,1.5904,205
2008.07.14,06:00,1.5903,1.5911,1.5898,1.5899,239
2008.07.14,07:00,1.5898,1.5902,1.5865,1.5882,541
2008.07.14,08:00,1.5883,1.5910,1.5868,1.5870,689
2008.07.14,09:00,1.5869,1.5890,1.5860,1.5877,763
2008.07.14,10:00,1.5878,1.5881,1.5841,1.5871,835
2008.07.14,11:00,1.5870,1.5876,1.5854,1.5859,533
Thanks,
Pierre8r
> See ?read.zoo
>
> 1) You need to specify the correct delimiter for your file.
> 2) read.zoo is converting your index to Date (the default),
> use
> POSIXct instead and be sure to specify the correct format
> of the index
> in your file.
>
> quotes <- read.zoo(textConnection(Lines),
> sep=',',
> FUN=as.POSIXct, format='%m/%d/%Y %H:%M:%S')
> x <- as.xts(quotes)
> colnames(x) <-
> c('Open','High','Low','Close','Volume')
>
> --
> http://quantemplation.blogspot.com
>
>
____________________________________________________________
ente http://mail.yahoo.fr
More information about the R-SIG-Finance
mailing list