Re: [R] Including time in a zoo

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue 10 Oct 2006 - 23:20:07 GMT

Its saying you are trying to pass a list to zoo (a data frame is a list); however, from ?zoo we see zoo takes a first argument of: "a numeric vector, matrix or a factor".

On 10/10/06, Horace Tso <Horace.Tso@pgn.com> wrote:
> dear list,
>
> I have these hourly price data over a 20 year period. Among other things, I want to plot them with time on the x-axis. The data is in a data frame,
>
> > head(OWI.SE.all)
> Record_Number Name Condition Time_Period Price
> 13 12 WECC-OWI SouthEast All 1/1/2012 Hour: 1 41.21383
> 28 27 WECC-OWI SouthEast All 1/1/2012 Hour: 2 38.38091
> 43 42 WECC-OWI SouthEast All 1/1/2012 Hour: 3 39.97879
> 58 57 WECC-OWI SouthEast All 1/1/2012 Hour: 4 40.14156
> 73 72 WECC-OWI SouthEast All 1/1/2012 Hour: 5 38.21092
> 88 87 WECC-OWI SouthEast All 1/1/2012 Hour: 6 40.09152
>
> And the date-times are in a POSIX object dte1,
>
> > class(dte1)
> [1] "POSIXt" "POSIXlt"
>
> When I tried to create a zoo with dte1 as the index, I got an error,
>
> > zoo(OWI.SE.all, dte1)
> Error in order(x, ..., na.last = na.last, decreasing = decreasing) :
> unimplemented type 'list' in 'orderVector1'
>
> I guess that's saying the index of a zoo can't have a time component. Am I correct? If so, is there a way to include an hour component in a zoo object.
>
> Second question:
>
> If I just attach this dte1 to my data frame as a column named Date and try plotting it as,
>
> > plot(OWI.SE.all$Date, OWI.SE.all$Price, type="l")
>
> I got non-sensical result. How do I plot hourly data in general?
>
> TIA.
>
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



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 and provide commented, minimal, self-contained, reproducible code. Received on Wed Oct 11 09:24:30 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 Wed 11 Oct 2006 - 00:30:10 GMT.

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