title: Using cbind and naming time series matrices
body: <p>When the <code>cbind</code> function is used to combine 2 or more matrices, the resulting matrix inherits the column names. An easy example of this fact is the following. I have two (2x2) matrices <code>m1</code> and <code>m2</code>. The columns of <code>m1</code> are <code>a</code> and <code>b</code>; the columns of <code>m2</code> are <code>c</code> and <code>d</code>. If I <code>cbind</code> <code>m1</code> and <code>m2</code>, I obtain a matrix with 4 columns named: <code>a</code>, <code>b</code>, <code>c</code> and <code>d</code>.</p>
  
  <pre><code>&gt; m1 &lt;- matrix(1:10, ncol = 2)
  &gt; colnames(m1) &lt;- letters[1:2]
  &gt; m2 &lt;- matrix(11:20, ncol = 2)
  &gt; colnames(m2) &lt;- letters[3:4]
  &gt; 
  &gt; M &lt;- cbind(m1, m2)
  &gt; M
       a  b  c  d
  [1,] 1  6 11 16
  [2,] 2  7 12 17
  [3,] 3  8 13 18
  [4,] 4  9 14 19
  [5,] 5 10 15 20
  </code></pre>
  
  <p>However, I just realized that if the matrices <code>m1</code> and <code>m2</code> contain time series data, the naming convention for the resulting matrix after a <code>cbind</code> changes.</p>
  
  <pre><code>&gt; m3 &lt;- ts(m1)
  &gt; m4 &lt;- ts(m2)
  &gt; M2 &lt;- cbind(m3, m4)
  &gt; M2
  Time Series:
  Start = 1 
  End = 5 
  Frequency = 1 
    m3.a m3.b m4.c m4.d
  1    1    6   11   16
  2    2    7   12   17
  3    3    8   13   18
  4    4    9   14   19
  5    5   10   15   20
  </code></pre>
  
  <p>As you can see, the column names of the <code>M2</code> are prefixed by the names of the matrices they originally belong to, which is my problem. I would like to keep the matrices in time series format, but avoid the new naming convention. As I read the documentation for <code>cbind</code>, I discovered the <code>deparse.level</code> argument, but it was of no help:</p>
  
  <pre><code>M2 &lt;- cbind(m3, m4, deparse.level = 0)
  M2
  </code></pre>
  
  <p>Of course, the easy workaround is to just create a character vector combining the column names of the original matrices and use it to name the columns of the new matrix; however, I was curious to know if something could be done about it.</p>
  
  <pre><code>&gt; column_names &lt;- c(colnames(m3), colnames(m4))
  &gt; colnames(M2) &lt;- column_names
  &gt; M2
  Time Series:
  Start = 1 
  End = 5 
  Frequency = 1 
    a  b  c  d
  1 1  6 11 16
  2 2  7 12 17
  3 3  8 13 18
  4 4  9 14 19
  5 5 10 15 20
  </code></pre>
  
  <p>Your help is very much appreciated.</p>