[R] multiple time series
Gabor Grothendieck
ggrothendieck at myway.com
Mon Sep 27 07:45:32 CEST 2004
There is no $.ts defined in R; however, you can define your own if you wish.
"$.ts" <- function(x, i) x[,as.character(substitute(i))]
z$foo # using z from below
Banachewicz KP <konradb <at> fluit.cs.vu.nl> writes:
:
: thanks Dirk, I missed the obvious z[,i] option (shame on me ;-(
: however, when I tried to use z$foo I get a NULL, despite the fact that
: this particular column is not empty. any idea why ?
:
: rg,
:
: Konrad
:
: On Sun, 26 Sep 2004, Dirk Eddelbuettel wrote:
: > 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.
More information about the R-help
mailing list