title: R: Tie Simulations in dplyr mutate
body: <p>I would like to generate a bivariate distribution within a tibble. Here is what I'm attempting to create:</p>
  
  <pre><code>library(copula); library(tidyverse)
  n &lt;- 10e3; alpha &lt;- 2.6
  tib1 &lt;- tibble(locid = seq(n))
  tib2 &lt;- rCopula(n, gumbelCopula(alpha)) %&gt;% as_tibble
  plot(tib2$V1, tib2$V2)
  </code></pre>
  
  <p><img src="https://i.ibb.co/NjFtVgZ/Capture.png" alt="a busy cat"></p>
  
  <p>Where <code>cor(tib2$V1, tib2$V2)</code> is roughly <code>0.8</code></p>
  
  <p>However, when I insert this as a function into a tibble, it does not seem to work as expected i.e. K1 and K2 are uncorrelated. </p>
  
  <pre><code>testfn &lt;- function(n) rCopula(n, gumbelCopula(alpha)) %&gt;% as_tibble
  
  tib3 &lt;- tib1 %&gt;% 
  mutate(K1 = testfn(n)$V1,
         K2 = testfn(n)$V2)
  </code></pre>
  
  <p>i.e. <code>cor(tib3$K1, tib3$K2)</code> is <code>zero</code></p>
  
  <p>The reason why I'd like to do this in dplyr instead doing something like, <code>cbind</code>, for example is because I want to manipulate K1 and K2 within the mutate function.</p>
  
  <p>Thank you.</p>