<div dir="ltr"><div class="gmail_extra"><div>tab1 = as.data.frame(tab1)</div><div>tab2 = as.data.frame(tab2)</div><div>res = merge(tab1, tab2, by.x=c('v1', 'v2'), by.y=c('C1', 'C2'))</div><div>

<br></div><br><div class="gmail_quote">2013/12/16 Hélio Gallo Rocha <span dir="ltr"><<a href="mailto:heliogallorocha@gmail.com" target="_blank">heliogallorocha@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Senhores, bom dia.<div><br></div><div>Preciso de uma ajuda, onde tenho dois arquivos de texto ou xls, tanto faz.</div>


<div>Inventei este exemplo:</div><div><br></div><div><div>v1 <- seq(1,50,by=1) </div><div>
v2 <- seq(1,100,by=2)</div><div>tab1 <- cbind(v1,v2)</div><div><br></div><div><br></div><div>C1 <- seq(1,100,by=1)</div><div>C2 <- seq(1,100,by=1)</div><div>dados <- seq(11,60,by=1)</div><div>tab2 <- cbind(C1,C2,dados)</div>



</div><div><br></div><div>Verão que tab1 possui 50 linhas e tab2 100 linhas<br></div><div><br></div><div>Preciso:</div><div>1. comparar e filtrar as colunas onde v1  = C1 e v2 = C2  </div><div>2. Gerar uma terceira com C1 e C2 e os dados</div>



<div><br></div><div>O resultado do exemplo acima seria</div><table border="0" cellpadding="0" cellspacing="0" width="192" style="border-collapse:collapse;width:144pt">
 <colgroup><col width="64" span="3" style="width:48pt">
 </colgroup><tbody><tr height="17" style="height:12.75pt">
  <td height="17" width="64" style="height:12.75pt;width:48pt">"C1"</td>
  <td width="64" style="border-left-style:none;width:48pt">"C2"</td>
  <td width="64" style="border-left-style:none;width:48pt">"dados"</td>
 </tr>
 <tr height="17" style="height:12.75pt">
  <td height="17" width="64" style="height:12.75pt;width:48pt">1</td>
  <td width="64" style="border-left-style:none;width:48pt">1</td>
  <td width="64" style="border-left-style:none;width:48pt">11</td>
 </tr></tbody></table><br>em SQL seria <div><br></div><div><div>SELECT tab1.["v1"], tab1.["v2"], tab2.["dados"]</div><div>FROM tab2 INNER JOIN tab1 ON (tab2.["C2"] = tab1.["v2"]) AND (tab2.["C1"] = tab1.["v1"]);</div>



</div><div><br></div><div>Tem como passar para o R?</div><div><br></div><div>Agradeço desde já</div><span><font color="#888888"><div><div><br></div>-- <br>Hélio Gallo Rocha<br>IFSULDEMINAS - Câmpus Muzambinho<br>

</div></font></span></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div></div>