<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>dados<-read.table(header = F, stringsAsFactors = F, text = "</div>
<div>n     id     UF    x2002 x2003 x2004 x2005 x2006 x2007 x2008 x2009 x2011 x2012 x2013 x2014</div>
<div>1  1     Acre      192    189     311     311     333    327      338    354     357     381     337   373</div>
<div>2  2  Alagoas  1251  1269  1292    1357   1413  1410    1355  1401   1344   1391   1429  1417</div>
<div>3  3    Amapá    204   198   239   262   252   294   317   299   302   311   332   355</div>
<div>4  4 Amazonas   958  1050  1433  1528  1502  1488  1531  1673  1689  1720  1771  1908</div>
<div>5  5    Bahia  6885  6901  7167  7336  7292  7338  7665  7792  7602  7416  7530  7879</div>
<div>6  6    Ceará  3705  3871  3944  4120  4143  4138  4314  4380  4121  4184  4215  4319</div>
<div>  ")</div>
<div>dados</div>
<div>dados1<-t(dados)</div>
<div>dados1</div>
<div><br>
</div>
<div>dados2<-dados1[c(-1,-2),]</div>
<div>dados2</div>
<div><br>
</div>
<div>dados3<-as.data.frame(dados2)</div>
<div>rownames(dados3)<-NULL</div>
<div>colnames(dados3)<-NULL</div>
<div>dados3</div>
<br>
<p></p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> R-br <r-br-bounces@listas.c3sl.ufpr.br> em nome de Edson Lira via R-br <r-br@listas.c3sl.ufpr.br><br>
<b>Enviado:</b> quinta-feira, 16 de novembro de 2017 11:16<br>
<b>Para:</b> a lista Brasileira oficial de discussão do programa R.<br>
<b>Assunto:</b> [R-br] Reshape</font>
<div> </div>
</div>
<div>
<div style="color:#000; background-color:#fff; font-family:times new roman,new york,times,serif; font-size:16px">
<div id="x_yui_3_16_0_ym19_1_1510346106424_183614"><span id="x_yui_3_16_0_ym19_1_1510346106424_183801">Bom dia caros amigos, estou trabalhando com a base de dados abaixo(somente 6 linhas):<br>
</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_183758"><span><br>
</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_183677" dir="ltr"><span id="x_yui_3_16_0_ym19_1_1510346106424_183699">   id     UF    x2002 x2003 x2004 x2005 x2006 x2007 x2008 x2009 x2011 x2012 x2013 x2014<br id="x_yui_3_16_0_ym19_1_1510346106424_183692">
1  1     Acre      192    189     311     311     333    327      338    354     357     381     337   373<br id="x_yui_3_16_0_ym19_1_1510346106424_183693">
2  2  Alagoas  1251  1269  1292    1357   1413  1410    1355  1401   1344   1391   1429  1417<br id="x_yui_3_16_0_ym19_1_1510346106424_183694">
3  3    Amapá    204   198   239   262   252   294   317   299   302   311   332   355<br id="x_yui_3_16_0_ym19_1_1510346106424_183695">
4  4 Amazonas   958  1050  1433  1528  1502  1488  1531  1673  1689  1720  1771  1908<br id="x_yui_3_16_0_ym19_1_1510346106424_183696">
5  5    Bahia  6885  6901  7167  7336  7292  7338  7665  7792  7602  7416  7530  7879<br id="x_yui_3_16_0_ym19_1_1510346106424_183697">
6  6    Ceará  3705  3871  3944  4120  4143  4138  4314  4380  4121  4184  4215  4319<br id="x_yui_3_16_0_ym19_1_1510346106424_183698">
<br>
</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_183673"><span id="x_yui_3_16_0_ym19_1_1510346106424_184031">Estou  usando o reshape para tentar transformar as linhas em colunas, ou seja, cada uma UF seria uma coluna, e assim com as demais</span></div>
<div><span>Como gostaria que ficasse:</span></div>
<div><span><br>
</span></div>
<div dir="ltr" id="x_yui_3_16_0_ym19_1_1510346106424_184034"><span id="x_yui_3_16_0_ym19_1_1510346106424_184033">Acre Alagoas Amapá Amazonas Bahia Ceará  ano<br>
</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_183674"><span id="x_yui_3_16_0_ym19_1_1510346106424_184043">192      1251                                             3705  2002<br>
</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184076"><span id="x_yui_3_16_0_ym19_1_1510346106424_184075">189      1269                                             3871  2003<br>
</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184078"><span id="x_yui_3_16_0_ym19_1_1510346106424_184077">311     1293                                              3944  2004<br>
</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184086"><span>...       ....</span></div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_183628">
<div id="x_yui_3_16_0_ym19_1_1510346106424_184087"> </div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184089">Estou usando a rotina:</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184091"><br>
</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184093"><br>
</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184112" dir="ltr">pea<-reshape(pea1, <br id="x_yui_3_16_0_ym19_1_1510346106424_184141">
                  varying=c("x2002","x2003","x2004","x2005","x2006","x2007",<br id="x_yui_3_16_0_ym19_1_1510346106424_184142">
                  "x2008","x2009","x2011","x2012","x2013","x2014"),<br id="x_yui_3_16_0_ym19_1_1510346106424_184143">
                   v.names="Medida",<br id="x_yui_3_16_0_ym19_1_1510346106424_184144">
                   timevar="UF",<br id="x_yui_3_16_0_ym19_1_1510346106424_184145">
                   times=c("Acre","Alagoas","Amapá","Amazonas","Bahia",<br id="x_yui_3_16_0_ym19_1_1510346106424_184146">
                         "Ceará","Distrito Federal","Espírito Santo",<br id="x_yui_3_16_0_ym19_1_1510346106424_184147">
                         "Goiás","Maranhão","Mato Grosso","Mato Grosso do Sul",<br id="x_yui_3_16_0_ym19_1_1510346106424_184148">
                         "Minas Gerais","Pará","Paraíba","Paraná"," Pernambuco",<br id="x_yui_3_16_0_ym19_1_1510346106424_184149">
                         "Piauí","Rio de Janeiro","Rio Grande do Norte",<br id="x_yui_3_16_0_ym19_1_1510346106424_184150">
                         "Rio Grande do Sul","Rondônia","Roraima",<br id="x_yui_3_16_0_ym19_1_1510346106424_184151">
                         "Santa Catarina","São Paulo","Sergipe","Tocantins"),<br id="x_yui_3_16_0_ym19_1_1510346106424_184152">
                   new.row.names=1:27,<br id="x_yui_3_16_0_ym19_1_1510346106424_184153">
                   direction="wide")<br id="x_yui_3_16_0_ym19_1_1510346106424_184154">
<br>
</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184160">que está me dando o erro:</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184237"><br>
</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184162" dir="ltr">Erro em varying[, i] : número incorreto de dimensões<br id="x_yui_3_16_0_ym19_1_1510346106424_184195">
<br>
</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184164">Alguém tem alguma sugesstão?<br>
</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184210"><br>
</div>
<div id="x_yui_3_16_0_ym19_1_1510346106424_184219">[  ]'s<br>
</div>
</div>
<div class="x_signature" id="x_yui_3_16_0_ym19_1_1510346106424_183630">Prof. Edson Lira, Me
<br>
Estatístico<br>
Manaus-Amazonas</div>
</div>
</div>
</div>
</div>
</body>
</html>