title: How to get items for both LHS and RHS for only specific columns in arules?
body: <p>Within the apriori function, I want the outcome to only contain these two variables in the LHS <code>HouseOwnerFlag=0</code> and <code>HouseOwnerFlag=1</code>. The RHS should only contain attributes from the column <code>Product</code>. For instance:</p>
  
  <pre><code>#   lhs                   rhs                                          support confidence     lift
  # 1 {HouseOwnerFlag=0}    =&gt; {Product=SV 16xDVD M360 Black}            0.2500000  0.2500000 1.000000
  # 2 {HouseOwnerFlag=1}    =&gt; {Product=Adventure Works 26" 720p}        0.2500000  0.2500000 1.000000
  # 3 {HouseOwnerFlag=0}    =&gt; {Product=Litware Wall Lamp E3015 Silver}  0.1666667  0.3333333 1.333333
  # 4 {HouseOwnerFlag=1}    =&gt; {Product=Contoso Coffee Maker 5C E0900}   0.1666667  0.3333333 1.333333
  </code></pre>
  
  <p>Part of the answer is solved in this question:
  <a href="https://stackoverflow.com/questions/18314800/r-arules-mine-only-rules-from-specific-column">R arules, mine only rules from specific column</a></p>
  
  <p>So now I use the following: <br/>
  <code>rules &lt;- apriori(sales, parameter=list(support =0.01, confidence =0.8, minlen=2), appearance = list(lhs=c("HouseOwnerFlag=0", "HouseOwnerFlag=1")))</code></p>
  
  <p>Then I use this from that other SO question to ensure that only the Product column is on the RHS: <br/>
  <code>inspect( subset( rules, subset = rhs %pin% "Product=" ) )</code> </p>
  
  <p>The outcome is like this:</p>
  
  <pre><code>#   lhs                                                                  rhs                                          support confidence     lift
  # 1 {ProductKey=153, IncomeGroup=Moderate, BrandName=Adventure Works }    =&gt; {Product=SV 16xDVD M360 Black}            0.2500000  0.2500000 1.000000
  # 2 {ProductKey=176, MaritalStatus=M, ProductCategoryName=TV and Video }  =&gt; {Product=Adventure Works 26" 720p}        0.2500000  0.2500000 1.000000
  # 3 {BrandName=Southridge Video, NumberChildrenAtHome=0 }                 =&gt; {Product=Litware Wall Lamp E3015 Silver}  0.1666667  0.3333333 1.333333
  # 4 {HouseOwnerFlag=1, BrandName=Southridge Video, ProductKey=170 }       =&gt; {Product=Contoso Coffee Maker 5C E0900}   0.1666667  0.3333333 1.333333
  </code></pre>
  
  <p>So apparently the LHS is able to contain every possible column, not just <code>HouseOwnerFlag</code> like I specified. From other stackoverflow questions, I see that I can put <code>default="rhs"</code> in the apriori function, like so: <br/>
  <code>rules &lt;- apriori(sales, parameter=list(support =0.001, confidence =0.5, minlen=2), appearance = list(lhs=c("HouseOwnerFlag=0", "HouseOwnerFlag=1"), default="rhs"))</code> <br/></p>
  
  <p>Then upon inspecting (without the subset part, just <code>inspect(rules</code>), there are far less rules (7) than before but it does indeed only contain <code>HouseOwnerFlag</code> in the LHS:</p>
  
  <pre><code>#   lhs                   rhs                           support     confidence lift
  # 1 {HouseOwnerFlag=0}    =&gt; {MaritalStatus=S}          0.2500000  0.2500000   1.000000
  # 2 {HouseOwnerFlag=1}    =&gt; {Gender=M}                 0.2500000  0.2500000   1.000000
  # 3 {HouseOwnerFlag=0}    =&gt; {NumberChildrenAtHome=0}   0.1666667  0.3333333   1.333333
  # 4 {HouseOwnerFlag=1}    =&gt; {Gender=M}   0.1666667     0.3333333  1.333333
  </code></pre>
  
  <p>However on the RHS there's nothing from the column Product in the RHS. So it has no use to <code>inspect</code> it with <code>subset</code> as ofcourse it would return null. I tested it several times with different support numbers to experiment and see if Product would appear or not, but the 7 same rules remain the same. </p>
  
  <p>So my question is, how can I specify both the LHS (HouseOwnerFlag) and RHS (Product)? What am I doing wrong?</p>
  
  <p>EDIT: You can reproduce this problem by downloading this testdataset from <a href="https://www.dropbox.com/s/tax5xalac5xgxtf/testdf.txt?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/tax5xalac5xgxtf/testdf.txt?dl=0</a> 
  Mind you, I only took the first 20 rows from a huge dataset, so the output here won't have the same product names as the example I displayed above unfortunately. But the problem still remains the same. I want to be able to get only <code>HouseOwnerFlag=0</code>and/or <code>HouseOwnerFlag=1</code> on the LHS and the column <code>Product</code> on the RHS. </p>