[R] extracting columns from a ts series

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Sep 25 19:05:47 CEST 2001


Antonio wrote:
> 
> Hi All,
> 
> I have a time series called 'upwelling',  like this:
> 
> >upwell
> 
>         Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov
> 1984                          494.7 303.7 220.8 288.4 188.1 125.5 215.7
> 1985    56.0 127.4 165.8 189.4 261.6 223.7 186.3 150.2 107.8 120.3  91.1
> 
> from 1984 until 2000. How do I could extract, i.e, Jan or Dec columns from
> the data? Or how do I could calculate, say, winter upwelling: Dec+Jan+Feb+Mar?

See ?window

For Dec columns use 
 window(upwell, start=c(1984, 12), frequency=1)
 
Don't know an exact translation for "upwelling" in german, but to sum
over the specified 4 months, you can use:
 sum(window(upwell, start=c(1984, 12), end=c(1985,3)))

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list