I am a bit puzzled here and must be missing something quite basic. I want to extract columns from a multiple time series object. It can perhaps be done by making the ts object into a dataframe and then extracting them, but there is a direct way of subsetting time series as given in this question link

To figure out how to assign names to ts objects, ?ts shows

ts(data = NA, start = 1, end = numeric(), frequency = 1,
   deltat = 1, ts.eps = getOption("ts.eps"), class = , names = )

but on running the code in ?ts help, with or without the names parameter gives names(z) NULL.

z <- ts(matrix(rnorm(300), 100, 3), start=c(1961, 1), frequency=12) or z <- ts(matrix(rnorm(300), 100, 3), start=c(1961, 1), frequency=12, names=c("x1", "x2", "x3"))

Main question: 1. How does one assign names to columns in time series objects ts and mts ? 2. What are the methods of extracting columns directly from time series object along with the time index? Is it necessary to convert it to zoo or xts class? or add the time index separately?

To give an idea of problem I am trying to solve:

# using inbuilt ldeaths time series dataset
ldeaths
d <- diff(ldeaths)
percen <- quantile(d, 0.9)
i <- ifelse(d>percen, 1,0)
signal <- cbind(d,i) 

Now to extract the dataset for which the indicator is 1, with the time index, I am not sure how to proceed. str(signal) is an mts object but printing signal shows no time index.

Thanks a lot.

Edit
Report