Michael Green
2010-Sep-16 11:22 UTC
[R] How do I create a plotable zoo object based on weekly data?
Dear readers,
The problem is simple: I have weekly time series data with a maximum
week number of (52,53,52,52) in (2008,2009,2010,2011) respectively. That
means I have a dataset looking like this:
2008-01 value
2008-02 value
.
.
2011-52 value
And I would like to turn that data into a plotable zoo object. Now a
simple example containing 4 data points, each being on the December
28th, would be:
x <- zoo(rnorm(4), as.Date("2008-12-28")+0:3*365)
plot(x)
This works fine, but
y <- zoo(rnorm(4), format(as.Date("2008-12-28")+0:3*365,
"%Y-%U"))
plot(y)
gives me the following warning message:
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
2: In min(x) : no non-missing arguments to min; returning Inf
3: In max(x) : no non-missing arguments to max; returning -Inf
Anyone knows how to solve this?
Best regards,
Michael Green
Michael Green
2010-Sep-16 12:50 UTC
[R] How do I create a plotable zoo object based on weekly data?
Dear readers,
The problem is simple: I have weekly time series data with a maximum
week number of (52,53,52,52) in (2008,2009,2010,2011) respectively. That
means I have a dataset looking like this:
2008-01 value
2008-02 value
.
.
2011-52 value
And I would like to turn that data into a plotable zoo object. Now a
simple example containing 4 data points, each being on the December
28th, would be:
x <- zoo(rnorm(4), as.Date("2008-12-28")+0:3*365)
plot(x)
This works fine, but
y <- zoo(rnorm(4), format(as.Date("2008-12-28")+0:3*365,
"%Y-%U"))
plot(y)
gives me the following warning message:
Error in plot.window(...) : need finite 'xlim' values In addition:
Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
2: In min(x) : no non-missing arguments to min; returning Inf
3: In max(x) : no non-missing arguments to max; returning -Inf
Anyone knows how to solve this?
Best regards,
Michael Green
Seemingly Similar Threads
- Patch for legend.position={left,top,bottom} in ggplot2
- zoo plot warning messages - I don't know what they mean or how to inspect the data to figure this out
- plot(hist.default(1:10,plot=F)) error.
- Trouble with line of best fit
- How do I plot a line followed by two forecast points?