Caros colegas,<div><br></div><div>Estou com um problema básico, mas que não estou conseguindo resolver (falta de prática com o R...)</div><div><br></div><div>Estou com o seguinte banco de dados:</div><div><br></div><div><div>
                   resposta            fator           sujeito</div><div>1                   0.00                   R               1</div><div>2                   2.96                   R               1</div><div>3                  10.28                   R               1</div>
<div>4                  12.42                   R               1</div><div>5                  15.60                   R               1</div><div>6                  14.23                   R               1</div><div>7                  10.55                   R               1</div>
<div>8                   8.00                   R               1</div><div>9                   6.12                   R               1</div><div>10                  3.24                   R               1</div><div>11                  2.82                   R               1</div>
<div>12                  1.18                   R               1</div><div>13                  0.42                   R               1</div><div>14                  0.00                   R               1</div><div>15                  0.00                   R               1</div>
<div>16                  0.00                   T               2</div><div>17                  4.01                   T               2</div><div>18                 19.82                   T               2</div><div>19                 17.83                   T               2</div>
<div>20                 12.74                   T               2</div><div>21                  7.37                   T               2</div><div>22                  7.73                   T               2</div><div>23                  4.70                   T               2</div>
<div>24                  4.11                   T               2</div><div>25                  3.11                   T               2</div><div>26                  3.19                   T               2</div><div>27                  2.25                   T               2</div>
<div>28                  0.44                   T               2</div><div>29                  0.16                   T               2</div><div>30                  0.00                   T               2</div></div><div>
<br></div><div>Estou tentando utilizar a função unstack() para transformar este banco de dados longo em largo da seguinte forma:</div><div><br></div><div><table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="128" style="width:96.0pt;margin-left:2.75pt;border-collapse:collapse;mso-yfti-tbllook:
 1184;mso-padding-alt:0cm 3.5pt 0cm 3.5pt">
 <tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">R</font></span></p><p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1"><br></font></span></p><p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">T</font></span></p><p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:1;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">2,96</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">4,01</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:2;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">10,28</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">19,82</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:3;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">12,42</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">17,83</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:4;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">15,6</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">12,74</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:5;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">14,23</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">7,37</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:6;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">10,55</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">7,73</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:7;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">8</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">4,7</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:8;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">6,12</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">4,11</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:9;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">3,24</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">3,11</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:10;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">2,82</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">3,19</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:11;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">1,18</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">2,25</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:12;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0,42</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0,44</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:13;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0,16</font></span></p>
  </td>
 </tr>
 <tr style="mso-yfti-irow:14;mso-yfti-lastrow:yes;height:15.0pt">
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0</font></span></p>
  </td>
  <td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 3.5pt 0cm 3.5pt;
  height:15.0pt">
  <p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal"><span style="mso-ascii-font-family:Calibri;
  mso-fareast-font-family:"Times New Roman";mso-hansi-font-family:Calibri;
  mso-bidi-font-family:"Times New Roman";color:black;mso-fareast-language:PT-BR"><font class="Apple-style-span" size="1">0</font></span></p>
  </td>
 </tr></tbody></table></div><div><br clear="all">Alguém sabe como consigo fazer essa mudança com ou sem a função unstack()?</div><div><br></div><div>Obrigado e abraço!</div><div><br></div><div>Rodrigo Pereira<br>(31)9326 3139<br>

</div>