title: R item lists to wide format
body: <p>I have a data frame of item lists, where each row in the data frame contain LHS and RHS association rules with the corresponding support, confidence and lift.
  here's the data:</p>
  
  <pre><code>structure(list(rules = structure(c(13L, 4L, 28L, 1L, 24L, 15L
  ), .Label = c("{butter,jam} =&gt; {whole milk}", "{butter,rice} =&gt; {whole milk}", 
  "{canned fish,hygiene articles} =&gt; {whole milk}", "{curd,cereals} =&gt; {whole milk}", 
  "{domestic eggs,rice} =&gt; {whole milk}", "{grapes,onions} =&gt; {other vegetables}", 
  "{hamburger meat,bottled beer} =&gt; {whole milk}", "{hamburger meat,curd} =&gt; {whole milk}", 
  "{hard cheese,oil} =&gt; {other vegetables}", "{herbs,fruit/vegetable juice} =&gt; {other vegetables}", 
  "{herbs,rolls/buns} =&gt; {whole milk}", "{herbs,shopping bags} =&gt; {other vegetables}", 
  "{liquor,red/blush wine} =&gt; {bottled beer}", "{meat,margarine} =&gt; {other vegetables}", 
  "{napkins,house keeping products} =&gt; {whole milk}", "{oil,mustard} =&gt; {whole milk}", 
  "{onions,butter milk} =&gt; {other vegetables}", "{onions,waffles} =&gt; {other vegetables}", 
  "{pastry,sweet spreads} =&gt; {whole milk}", "{pickled vegetables,chocolate} =&gt; {whole milk}", 
  "{pork,butter milk} =&gt; {other vegetables}", "{rice,bottled water} =&gt; {whole milk}", 
  "{rice,sugar} =&gt; {whole milk}", "{soups,bottled beer} =&gt; {whole milk}", 
  "{tropical fruit,herbs} =&gt; {whole milk}", "{turkey,curd} =&gt; {other vegetables}", 
  "{whipped/sour cream,house keeping products} =&gt; {whole milk}", 
  "{yogurt,cereals} =&gt; {whole milk}", "{yogurt,rice} =&gt; {other vegetables}"
  ), class = "factor"), support = c(0.00193187595322827, 0.00101677681748856, 
  0.00172852058973055, 0.00101677681748856, 0.00111845449923742, 
  0.00132180986273513), confidence = c(0.904761904761905, 0.909090909090909, 
  0.80952380952381, 0.833333333333333, 0.916666666666667, 0.8125
  ), lift = c(11.2352693602694, 3.55786275006331, 3.16819206791352, 
  3.26137418755803, 3.58751160631383, 3.17983983286908)), .Names = c("rules", 
  "support", "confidence", "lift"), row.names = c(NA, 6L), class = "data.frame")
  </code></pre>
  
  <p>What I need is to structure these rules into a wide format, where for each item in each LHS part of the rules will have a designated column with a value of 1 (to indicate that rule has that item in its LHD part), the same goes for the RHS of the rules, e.g. taking the 2 first rules:</p>
  
  <pre><code>{liquor,red/blush wine} =&gt; {bottled beer} 0.0019 0.90 11.2
  {curd,cereals} =&gt; {whole milk} 0.0010 0.91 3.6
  </code></pre>
  
  <p>The result should be a data frame that looks like:</p>
  
  <pre><code>'rules_id' 'lhs_liquor' 'lhs_red/blush wine' 'lhs_curd' 'lhs_cereals' 'rhs_bottled beer' 'rhd_whole milk' 'support' 'confidence' 'lift'
  1 1 1 0 0 1 0 0.0019 0.90 11.2
  2 0 0 1 1 0 1 0.0010 0.91 3.6 
  </code></pre>
  
  <p>As I am new to R and stack overflow please let me know if the question is not well defined
  Any help appreciated </p>