title: R - Need to extract two dataset but getting error "Error in fix.by(by.y, y)"
body: <p>I am trying to merge two datasets</p>
  
  <ol>
  <li><code>se_lif_1</code> with columns <code>SE_NO</code> and <code>TOT_CV_LIF</code></li>
  <li><p><code>ext_merchant_account</code> with the 76 columns that include:</p>
  
  <p>"SE_NO","SEIMS_INDUS_DS_CD","CUR_MER_STA_CD","CLNT_MAN_CHAN_CD","MER_SETUP_DT"</p></li>
  </ol>
  
  <p>By using below code:</p>
  
  <pre><code>se_lif_2 &lt;- merge(se_lif_1,
       ext_merchant_account[(ext_merchant_account$CUR_MER_STA_CD %in%
       c("A","R")) &amp; (ext_merchant_account$CLNT_MAN_CHAN_CD %in% 
       c("I","X", " ")) &amp; (ext_merchant_account$MER_SETUP_DT &lt; 
       S_date),"SEIMS_INDUS_DS_CD"],by = "SE_NO" )
  </code></pre>
  
  <p>But was getting below error:</p>
  
  <pre><code>"Error in fix.by(by.y, y) : 'by' must specify a uniquely valid column"
  </code></pre>
  
  <p>Also <code>S_date</code> is a object with class "Date" containing a single record which I am using in one of the logical condition to subset the data from <code>ext_merchant_account</code> data frame.</p>
  
  <p>I also checked the class of the variable in "by", which is same for both the dataset (i.e an integer).</p>
  
  <p>I also tried using <code>by.x</code> &amp; <code>by.y</code> but was getting the same error again.Could any one point out the error that I am doing in this code.</p>
  
  <p>Thanks for your help in advance.</p>
  
  <p>Cheers,</p>
  
  <p>Amit </p>