title: Function that only runs when matrices has NAs in it
body: <p>I have two matrices, one of them has a NA value and I want to use a function that only runs if there are <code>NA</code>s present in the data, so if I run the function it should only work on <code>df2</code> and not <code>df1</code>. How would I do this?</p>
  <pre><code>df1 &lt;- matrix(1:4, nrow = 2, ncol = 2)
  df2 &lt;- matrix(1,2,3,NA, nrow = 2, ncol = 2)
  
  </code></pre>