I have a data set stored as follows (only the first 3 rows of data):
The real data set extends until the year 2010. In other words, I have 20 years of data - 240 data points - stored in a matrix-like form whose lines are the years and the columns are the months from January to December.
I would like to know how to convert this data into a time series object, with the first occurrence taking place in Jan. 1990, and the last in Dec. 2010.
I tried:
myData.st = ts(myData, start = c(1990,1), end = c(2010,12), frequency = 12)
but it didn't work correctly. It seems that if I execute the line above, I'll have 20 independent time series objects, each one with only 12 data points.
I want one single time-series object from Jan. 1990 to Dec.2010. One of the main difficulties for me is how to "let R know" that after one row ends in December of a given year, the next value should be taken from January of the next year.
I have found examples of how to convert a data frame into a time series object. However, the data frames in the examples I came across would have a specific column which to convert. Not in this case. Here, all columns have data points of interest.
How can I accomplish that? Would I be able to accomplish this with either the zoo or the xls packages?
Thank you.