title: how to simulate correlated binary data with R?
body: <p>Supposing I want 2 vectors of binary data with specified phi coefficients, how could I simulate it with R?</p>
  
  <p>For example, how can I create two vectors like <code>x</code> and <code>y</code> of specified vector length with the cor efficient of 0.79</p>
  
  <pre><code>&gt; x = c(1,  1,  0,  0,  1,  0,  1,  1,  1)
  &gt; y = c(1,  1,  0,  0,  0,  0,  1,  1,  1)
  &gt; cor(x,y)
  [1] 0.7905694
  </code></pre>