title: R - replacing the zero values in *just one row* of a matrix with NA
body: <p>Matrix <code>A</code> has some zeros and ones in its first row.</p>
  <pre><code>A &lt;- matrix(data=c( 0,0,1,1,0,0,0,1,0,  #1
                      0,0,0,0,1,0,0,0,0,  #2
                      1,0,0,0,0,0,0,0,0,  #3
                      1,0,0,0,0,0,0,0,1,  #4
                      0,1,0,0,0,1,0,0,0,  #5
                      0,0,0,0,1,0,0,0,0,  #6
                      0,0,0,0,0,0,0,0,0,  #7
                      1,0,0,0,0,0,0,0,0,  #8
                      0,0,0,1,0,0,0,0,0 ),#9
              nrow=9, ncol=9)
  </code></pre>
  <p>I need to replace the zeros in <em>only this row</em> with <code>NA</code> values. The <code>result</code> should look like this:</p>
  <pre><code>result &lt;- matrix(data=c( NA,NA,1,1,NA,NA,NA,1,NA,  #1
                      0,0,0,0,1,0,0,0,0,  #2
                      1,0,0,0,0,0,0,0,0,  #3
                      1,0,0,0,0,0,0,0,1,  #4
                      0,1,0,0,0,1,0,0,0,  #5
                      0,0,0,0,1,0,0,0,0,  #6
                      0,0,0,0,0,0,0,0,0,  #7
                      1,0,0,0,0,0,0,0,0,  #8
                      0,0,0,1,0,0,0,0,0 ),#9
              nrow=9, ncol=9)
  </code></pre>
  <p><a href="https://stackoverflow.com/questions/11036989/replace-all-0-values-to-na">Other solutions to similar problems</a> that fully replace a given value in the entire matrix with another value do not apply, and I'm surprised that I haven't been able to extend these solutions.</p>