[R] Newbie Time Series Questions
Robert Schick
Robert.Schick at noaa.gov
Thu Oct 17 21:39:08 CEST 2002
I have a data set of monthly river flows from 1960-2000, which are
similar in structure to the nottem data:
> klam.flow
Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug Sep
1961 1461 1716 2524 1773 1906 2005 1756 1575 1387 983 1094 1382
1962 1907 2253 1985 1907 1769 1676 2634 1386 929 766 968 1309
...
I tried plotting with
> ts.plot(klam.flow)
Which quickly led me to realize the data aren't a "ts" object, as it
plotted 40 stacked lines instead of one long series. I've tried
converting to this using ts or as.ts, e.g.
> klam.ts <- ts(data=klam.flow, start=1960,end=2000, frequency=12)
But this seems to explode the number of time series, e.g.
> klam.ts
Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug Sep
Jan 1960 1461 1716 2524 1773 1906 2005 1756 1575 1387 983 1094 1382
Feb 1960 1907 2253 1985 1907 1769 1676 2634 1386 929 766 968 1309
Mar 1960 2511 2852 3661 2103 2189 2548 3841 2937 857 743 1058 1574
...
Any advice on how to properly create the ts object so it looks and plots
a la Figure 13.15 in VR?
I'm using R 1.60 on a Windows 2000 box.
Thanks
--
Rob Schick
Research Associate
NOAA Fisheries
Santa Cruz Lab
110 Shaffer Road
Santa Cruz, CA 95060
Phone: 831.420.3960
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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