[R] cbind'ing multivariate ts objects

From: Андрей Парамонов <cmr.pent_at_gmail.com>
Date: Sat, 14 Jun 2008 21:14:56 +0400


I use R 2.7.0 on GNU/Linux. I have noticed a problem in cbind method for multivariate time series (ts) objects. Consider the following example:

> t <- ts(data.frame(a = 10:20, b = 20:30, c = 30:40, d = 40:50))
> t1 <- t[, c('a', 'b')]
> t2 <- t[, c('c', 'd')]
>
> colnames(t1)

[1] "a" "b"
> colnames(t2)

[1] "c" "d"
> colnames(cbind(t1, t2))

[1] "t1.a" "t1.b" "t2.c" "t2.d"
>

Although it seems to be the documented behavior, I think it would be more consistent if the latter returned c("a", "b", "c", "d") instead. Is there a nice way to achieve this? Thanks!

Andrey Paramonov



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 14 Jun 2008 - 23:27:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 15 Jun 2008 - 16:30:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive