title: How to expand.grid on vectors sets rather than single elements
body: <p>So, I have the following four vectors</p>
  
  <pre><code>a1 &lt;- c(11, 12)
  a2 &lt;- c(21, 22)
  
  b1 &lt;- c(31, 32)
  b2 &lt;- c(41, 42)
  </code></pre>
  
  <p>and what I want to have in the end is a data frame that looks like</p>
  
  <pre><code>  p1 p2 p3 p4
  1 11 12 31 32
  2 21 22 31 32
  3 11 12 41 42
  4 21 22 41 42
  </code></pre>
  
  <p>i.e. every possible combination of the two <code>a</code> vectors with the two <code>b</code> vectors.</p>
  
  <p>What I did is</p>
  
  <pre><code>ab &lt;-  expand.grid(list(a1, a2), list(b1,b2))
  ab.new &lt;- ab %&gt;% separate(Var1, c("p1", "p2"), sep = ",") 
               %&gt;% separate(Var2, c("p3", "p4"), sep = ",")
  </code></pre>
  
  <p>and what I end up with is</p>
  
  <pre><code>    p1   p2   p3   p4
  1 c(11  12) c(31  32)
  2 c(21  22) c(31  32)
  3 c(11  12) c(41  42)
  4 c(21  22) c(41  42)
  </code></pre>
  
  <p>What are those <code>c(</code>s doing in there and how to get them out? Or, what did I do wrong in using <code>%&gt;%</code>?</p>