Re: [R] Converting data frame to zoo

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


Thanks Gabor. I figured out what went wrong. The culprit turns out to be the headers in my data. read.zoo doesn't recognize column headers and complains

Error in read.zoo("C:\\.......\\table.csv", :

        index contains NAs

Or is there an option as in read.table(x, header=...) ?

After the header line is removed it works fine.

H.

>>> "Gabor Grothendieck" <ggrothendieck@gmail.com> 7/7/2006 10:22 AM
>>>

Check out read.zoo in the zoo package.

On 7/7/06, Horace Tso <Horace.Tso@pgn.com> wrote:
> 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
>



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 04:08:36 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 - 06:15:54 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.