[R] as.xts error

Ted Zeng (曾振兴) zengzhenxing at gmail.com
Mon Dec 6 12:52:24 CET 2010


Dear all,

I am using the as.xts function to transfer a data frame to the xts 

The following is the code and result:

a<-read.csv("price.csv")
a$Date<-as.POSIXct(a$Date)

str(a)
'data.frame':	15637 obs. of  2 variables:
 $ Date   : POSIXct, format: "2010-01-04 09:45:01" "2010-01-04 09:45:02"
"2010-01-04 09:45:03" ...
 $ bid_hsi: int  21850 21864 21864 21867 21859 21849 21849 21850 21854 21853
...

head(a)

              Date bid_hsi
1 2010-01-04 09:45:01   21850
2 2010-01-04 09:45:02   21864
3 2010-01-04 09:45:03   21864
4 2010-01-04 09:45:04   21867
5 2010-01-04 09:45:05   21859
6 2010-01-04 09:45:06   21849

p<-as.xts(a)
Error in as.POSIXlt.character(x, tz, ...) : 
  character string is not in a standard unambiguous format

Please help me to use the function as.xts correctly.

Thanks

Ted 


-- 
View this message in context: http://r.789695.n4.nabble.com/as-xts-error-tp3074335p3074335.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list