title: Logical subscript too long in R
body: <p>This might be a simple question, but can someone explain why the 3rd line of code below yields an error of &quot;logical subscript too long&quot;? And what is the difference between the 2nd and 3rd lines of code? Thanks!</p>
  <pre><code>try2 &lt;- matrix(1 : 50, nrow = 10, byrow = TRUE)
  
  try2[try2 &lt; 10] &lt;- 0
  
  try2[try2 &lt; 10,] &lt;- 0
  </code></pre>