-1

I have time series data that appears like below:

data

          Jan      Feb      Mar      Apr      May      Jun      Jul      Aug      Sep      
1960 -10.3000  -7.1000   2.9000  18.0000  18.9000  29.5000  31.4000  28.0000  20.7000  
1961  -1.8000  -4.2000   4.0000  13.2000  22.0000  23.4000  24.0000  23.4000  17.3000  
1962 -12.1000  -3.1000  -0.1000   9.5000  22.9000  24.4000  26.4000  30.0000  21.2000  
1963  -2.9000  -5.9000   5.4000   9.3000  21.0000  25.3000  27.9000  24.6000  21.4000  
1964  -2.8000  -7.4000   2.2000   9.1000  17.6000  25.3000  25.1000  25.3000  18.0000  
1965  -9.5000   1.0000   6.3000  14.3000  18.3000  24.7000  28.4000  26.7000  21.9000  
1966  -5.4000  -2.7000   6.6000  14.3000  17.7000  24.2000  26.2000  25.3000  20.5000   
1967  -8.1000  -0.6000   3.0000  13.8000  23.2000  23.8000  27.6000  24.3000  20.4000     

I want to plot the data on monthly scale, for example, I want to plot data of January month from 1960-1967. I tried using zoo function but it does not work. The problem is that even after installing zoo package, the zoo function seems to be unrecognized by the system. The error message looks like this:

> install.packages("zoo")
Installing package(s) into ‘C:/Users/skhanal2.RUSSELL/Documents/R/win-library/2.15’
(as ‘lib’ is unspecified)
trying URL 'http://streaming.stat.iastate.edu/CRAN/bin/windows/contrib/2.15/zoo_1.7-9.zip'
Content type 'application/zip' length 868277 bytes (847 Kb)
opened URL
downloaded 847 Kb
package ‘zoo’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘zoo’

The downloaded binary packages are in
        C:\Users\skhanal2.RUSSELL\AppData\Local\Temp\RtmpCSHWVD\downloaded_packages
> test<-zoo(data,by="month")
**Error: could not find function "zoo"**

Has anyone tried to plot time series data by month?If so, I would appreciate if someone could help me find the solution. Also, can anyone suggest what is the problem in zoo function? I am using R version 2.15.2 and I am using Windows 7 in 32 bit machine. Thanks!

4

1 に答える 1

1

It isn't enough to install the package. You also have to load it into memory using the library() command, e.g. library(zoo). Once you get the zoo package loaded correctly...

 test<-zoo(data,order.by=sort(data$year))
 plot(test)
 #or
 plot(test[,c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep")])
于 2013-02-18T17:14:25.860 に答える