[R] Converting data frame to zoo

From: Horace Tso <Horace.Tso_at_pgn.com>
Date: Sat 08 Jul 2006 - 03:06:08 EST


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@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

R-help@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 Received on Sat Jul 08 03:12:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 08 Jul 2006 - 04:15:22 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.