[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 18:54:50 CEST 2008
Hi,
Don't success to create xts from lines in code
Here my R code :
---------------
library(quantmod)
library(xts)
Lines <-
"01/08/2007 00:59:00,1.930250,1.930350,1.929300,1.929600,-60
01/08/2007 01:59:00,1.929600,1.930100,1.926250,1.928050,-60
01/08/2007 02:59:00,1.928050,1.929700,1.927700,1.927800,-60
01/08/2007 03:59:00,1.927800,1.928350,1.927200,1.928250,-60
01/08/2007 04:59:00,1.928250,1.929600,1.928250,1.929000,-60
01/08/2007 05:59:00,1.929000,1.929250,1.928650,1.929250,-60
01/08/2007 06:59:00,1.929250,1.930850,1.928700,1.930650,-60
01/08/2007 07:59:00,1.930650,1.933100,1.930250,1.933000,-60
01/08/2007 08:59:00,1.933000,1.934350,1.931050,1.931100,-60
01/08/2007 09:59:00,1.931100,1.934750,1.930350,1.934000,-60
01/08/2007 10:59:00,1.934000,1.934650,1.932300,1.932400,-60
01/08/2007 11:59:00,1.932400,1.933500,1.931200,1.933050,-60
01/08/2007 12:59:00,1.933050,1.933850,1.932100,1.933600,-60"
quotes <- read.zoo(textConnection(Lines))
x <- xts(as.matrix(quotes[,-1]),as.POSIXct(paste(quotes[,1]),
format='%m/%d/%Y %H:%M:%S'))
colnames(x) <- c('Open','High','Low','Close','Volume')
x
The message error :
-------------------
>
> quotes <- read.zoo(textConnection(Lines))
Warning message:
In zoo(rval, ix) :
some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
>
> x <- xts(as.matrix(quotes[,-1]),as.POSIXct(paste(quotes[,1]),
+ format='%m/%d/%Y %H:%M:%S'))
Warning messages:
1: In zoo(rval[i], x.index[i]) :
some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
2: In zoo(x = x, order.by = order.by, frequency = frequency) :
some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
3: In zoo(rval[i], x.index[i]) :
some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
____________________________________________________________
ente http://mail.yahoo.fr
More information about the R-SIG-Finance
mailing list