On Mon, Sep 27, 2004 at 04:13:14AM +0200, Banachewicz KP
wrote:> Hello everybody,
> I have the following problem: I read a multiple time series (along with
> column names), and then need to manipulate the univariate components
> separately in order to compute the statistics of interest. Can someone
> tell me how can I access the univariates separately through their names ?
It works the usual way:
> z <- ts(matrix(rnorm(300), 100, 3), start=c(1961, 1), frequency=12)
> colnames(z) <- c("foo","bar","boo")
> summary(z[,"boo"])
Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.92700 -0.79140 -0.08982 -0.10660 0.54350 2.32600>
You could also use z$foo, or z[,1] -- i.e. it works just like the data frames.
Dirk
--
Those are my principles, and if you don't like them... well, I have others.
-- Groucho Marx