Skip to content
Prev 51544 / 63421 Next

problem plotting "ts" in a data.frame

On Tue, 2016-02-09 at 16:56 -0600, Spencer Graves wrote:
The plot function is generic so the actual function call depends on what
arguments you give it: plot(y.ts) calls the plot.ts method from the
stats package, whereas plot(y.ts ~ x) calls the plot.formula method from
the graphics package. Only the plot.formula method has a data argument.

What happens when you call plot(y1~x1, data=XY) is that first
plot.formula is called and then this calls plot.ts with two arguments
(XY$x1 and XY$y1) that are expected to be compatible time series.
However, they are not. In fact x1 is numeric and when coerced to a time
series it has no time points in common with y1 (which starts at time
t=5). Hence the warning about non-intersecting series.

Since non-overlapping series seems to be fatal in this context it might
be a good idea to give an error at this point. Otherwise I think the
function is behaving correctly.

Martyn
-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}