title: Sudden change of class from "matrix" to "integer"
body: <p>Apparently some matrices when indexed in a certain way stay matrices, others, indexed <strong>in the same way</strong>  become arrays. Example:</p>
  <pre><code>&gt; test = matrix(1:10, nrow = 2)
  &gt; class(test)
  [1] &quot;matrix&quot;
  &gt; class(test[,1:2])
  [1] &quot;matrix&quot;
  &gt; test = matrix(1:10, nrow = 1)
  &gt; class(test)
  [1] &quot;matrix&quot;
  &gt; class(test[,1:2])
  [1] &quot;integer&quot;
  </code></pre>
  <p>I would like to know:</p>
  <ol>
  <li>Why is this a feature and not a bug?</li>
  <li>Is there a polished way to make it stay a matrix? (I mean, sure, I could store <code>nrow(test)</code> somewhere and then use <code>matrix(test, nrow = somewhere)</code>) but i hope that there's a neat one-liner for something that in principle should have worked authomatically.</li>
  </ol>
  <p>P.S. Why I find this an issue? Because if I then transpose the vector with <code>t()</code> (the vector that lost the matrix structure) it gives me a row vector, I wanted a column vector, as it should have been in theory. Also, <code>rowMeans()</code> doesn't work anymore with that vector.</p>