[R] Converting data frame to zoo

Horace Tso Horace.Tso at pgn.com
Fri Jul 7 19:06:08 CEST 2006


Dear list,

I know this is really basic question but I just couldn't get anything
to work. (I did a R site search with keywords "zoo" and "data frame" but
the server timed out on me.)

I have a time series which has the following (typical) format,

DATE               Open          High          Low          Close      
  Volume
01-JAN-2006     5.25           5.25          5.25          5.25        
  256
....

I read the data in from a csv file with read.csv() and it defaulted to
a data frame which I thought is fine. Now I want to convert it to zoo so
I did

x <- zoo(my.df)

which works just fine. But the Date column has been turned into a
factor. Is there a way to make it into a Date. I've tried,

x$Date <- as.Date(x$Date)  

but R complains that

Error in fromchar(x) : character string is not in a standard
unambiguous format

Thanks in advance.

Horace W. Tso






______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html



More information about the R-help mailing list