title: How to use purrr's map function to perform row-wise prop.tests and add results to the dataframe?
body: <p>I'm trying to solve the following problem in R: I have a dataframe with two variables (number of successes, and number of total trials).</p>
  
  <pre><code># A tibble: 4 x 2
   Success     N
      &lt;dbl&gt; &lt;dbl&gt;
  1     28.   40.
  2     12.   40.
  3     22.   40.
  4      8.   40.
  </code></pre>
  
  <p>I would like to perform a prop.test or binom.test on each row and add the resulting list to the dataframe (or certain elements of it, like the p-value and CIs).</p>
  
  <p>Ideally, I would like to add a third column with the p-values and the CI-range. My attempts so far were painly unsuccessful. Here is a minimal coding example:</p>
  
  <pre><code>Success &lt;- c( 38, 12, 27, 9)
  N &lt;- c( 50, 50, 50, 50)
  df &lt;- as.tibble( cbind(Success, N))
  
  
  df %&gt;%
    map( ~ prop.test, x = .$Success, n = .$N)
  </code></pre>
  
  <p>Doesn't give the desired result. Any help would be much appreciated.</p>
  
  <p>Cheers,</p>
  
  <p>Luise </p>