title: Attempt to use tryCatch in an apply function in R
body: <p>The dataset is</p>
  <pre><code> structure(list(`total primary - yes RS` = c(0L, 1L, 0L, 138L, 
  101L), `total primary - no RS` = c(0L, 0L, 0L, 29L, 39L), `total secondary- yes rs` = c(0L, 
  0L, 0L, 6L, 15L), `total secondary- no rs` = c(0L, 0L, 0L, 0L, 
  7L)), row.names = c(NA, -5L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;
  ))
  </code></pre>
  <p>Then from the dataset i run this to to get chisquare for each line. Though this works normally here it does not because some of the values contain zero's.</p>
  <pre><code>yes&lt;-apply(sample, 1, function(x) tidy(chisq.test(matrix(x, ncol = 2)))) %&gt;%
  </code></pre>
  <p>bind_rows</p>
  <p>Though this script works i get an error message that says</p>
  <pre><code>at least one entry of 'x' must be positive
  </code></pre>
  <p>Is there a way to run the line of code i have but to skip the insufficient line?</p>