title: Can't coerce class of matrix numbers to integer
body: <p>I'm writing an adjacency matrix in <code>R</code> like so:</p>
  
  <pre><code>neighbours &lt;- array(0, c(100,100))
  for (i in 1:100) { neighbours[i,i] = 1 }    #reflexive
  </code></pre>
  
  <p>But then I notice that the <code>class(neighbours)</code> is <code>double matrix</code>. That's going to take up way too much room with a larger matrix. So I want to coerce the type to <code>integer</code> or, even better, since this is undirected, <code>logical</code>.</p>
  
  <p>But...</p>
  
  <pre><code>&gt; class(neighbours[5])
  [1] "numeric"
  &gt; class(neighbours[5]) &lt;- "integer"
  &gt; class(neighbours[5])
  [1] "numeric"
  </code></pre>
  
  <p>It is no listen to me!</p>