[R] Multiple time series and their names
ggrothendieck at gmail.com
Sat Oct 3 05:34:49 CEST 2009
zoo objects can have one column with a heading and convert back
faithfully to ts:
> as.zoo(x)[, 1, drop = FALSE]
 1.00 3.25 4.00
 1.00 3.25 4.00
On Fri, Oct 2, 2009 at 11:15 PM, David Stoffer <dsstoffer at gmail.com> wrote:
> Suppose I have multiple time series with names for each one, for example,
> x <- ts(matrix(rnorm(30,0,1),10,3), names=c("Juan", "Tuey", "Trey"),
> So now, as I start to explore these series, if I do everything at once, the
> stay attached to the series. For example,
> plot(x) # gives a plot of the series with their names
> acf(x) # gives the ACFs & CCFs with names attached
> But if I want to explore what's going on with Juan, from what I can gather,
> I have to do something like this
> (or acf(x[,1])... or similar things) but this doesn't keep the name Juan.
> My question: Is there a way, without making a data frame [which seems to
> destroy the
> time series attributes(??) - this seems to be the only answer I can find on
> that allows me to keep track of the names? That way, for example, I don't
> have to
> remember that the 18th series is Martha.
> x$Juan, x$Tuey, x$Trey, would be nice ... but that doesn't work.
> Thanks in advance.
> The power of accurate observation is commonly called cynicism
> by those who have not got it. George Bernard Shaw
> View this message in context: http://www.nabble.com/Multiple-time-series-and-their-names-tp25725411p25725411.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help