Changing data frame to time series properly

Hi all,

I'm trying to convert a data frame into a time series properly so I can plot the data without getting multiple graphs of all the different months. I have a reference time series that works but I can't seem to convert my data to make it behave the same.

Below is what the reference "month" data looks like when i ask its structure where it works with plotting.

str(month)
Time-Series [1:696] from 1951 to 2009: 1.48 1.58 2.24 1.11 2.4 ...

And here is the structure of my "temp_data4" that I need to fix

str(temp_data4)
Time-Series [1:128, 1:12] from 1880 to 2007: -3.0 -3.9 1.1 -0.4 ...
attr(*, "dimnames")=List of 2
..(dollar sign) : NULL
..(dollar sign) : chr [1:12] "JAN" "FEB" "MAR" "APR" ...

To get there, I used:

temp_data4 <- as.ts(read.zoo(temp_data3, FUN = as.yearmon))

and when I try to plot it I get the error:

plot(temp_data4)
Error in plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, :
cannot plot more than 10 series as "multiple"

The month data and temp_data4 look the same when I type it into the console with the months on the top and the years on the side, but there is something I am not getting in properly making it a time series for plotting on one graph.

Any help is appreciated!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.