<div dir="ltr">Tente usar o a função dcast, do pkg reshape2. Fiz isso no código abaixo:<div><br></div><div><br></div><div><div>> head(latlon_dist)</div><div>            ID_ZAP5M            parque   distance   dist_km</div><div>1: V_A20380-AM154583 ESTADUAL DO BELÉM 0.02678070  2.678070</div><div>2: V_A20380-AM154583        BURLE MARX 0.14722285 14.722285</div><div>3: V_A20380-AM154583     INDEPENDENCIA 0.02756847  2.756847</div><div>4: V_A20380-AM154583   JARDIM BOTANICO 0.08291090  8.291090</div><div>5: V_A20380-AM154583          CORDEIRO 0.11904040 11.904040</div><div>6: V_A20380-AM154583    PARQUE DO POVO 0.10402230 10.402230</div><div>> mdist2 <- dcast(data = latlon_dist, formula = ID_ZAP5M~parque, value.var = 'dist_km',</div><div>+                 fun.aggregate =mean)</div><div>> head(mdist2)<br></div><div>         ID_ZAP5M  ACLIMACAO BUENOS AIRES BURLE MARX     CERET CHACARA DO JOCKEY  CORDEIRO</div><div>1 V_A1-ZAP1001667  2.0396479     2.844645   8.525611  9.254039          9.502118  7.010958</div><div>2 V_A1-ZAP1002649  0.6065181     3.697467   9.611037  7.867584         10.874485  7.486414</div><div>3 V_A1-ZAP1004006  8.0701516     7.037070   3.100807 15.332267          3.451979  5.179773</div><div>4 V_A1-ZAP1004795 11.5358657     7.762406  10.507915 17.698645          7.621947 12.969276</div><div>5 V_A1-ZAP1008204  4.1418657     2.540428  12.543114  8.003843         12.639629 11.513499</div><div>6 V_A1-ZAP1008249  5.1073948     2.751751   7.304517 12.072894          7.164578  7.552054</div><div>  ESTADUAL DO BELÉM IBIRAPUERA INDEPENDENCIA JARDIM BOTANICO JUVENTUDE PARQUE DA LUZ</div><div>1          7.012610  0.9911163      3.912788        6.929003  7.002871    4.22853720</div><div>2          5.963840  1.9098469      2.423499        6.291981  6.818811    4.15078971</div><div>3         13.109059  4.3334982      9.775095        9.089064 12.112062    9.48957949</div><div>4         14.259577  9.2082404     13.394847       15.805615 11.000220    9.74552685</div><div>5          4.457268  5.4825756      5.225521       10.733382  2.514522    0.01950312</div><div>6          9.311688  2.4820681      7.008602        9.236796  7.819413    5.27780835</div><div>  PARQUE DO CARMO PARQUE DO POVO VILA LOBOS</div><div>1        17.57522       3.787772   7.036348</div><div>2        16.09237       5.148572   8.498657</div><div>3        23.30077       1.854193   4.814991</div><div>4        26.52802       7.770679   1.925128</div><div>5        16.86382       7.464910   8.188995</div><div>6        20.60717       2.319196   3.899231</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">Em 16 de novembro de 2017 11:26, João Pedro Domingues via R-br <span dir="ltr"><<a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="PT-BR" link="#0563C1" vlink="#954F72">
<div class="m_-8828528976892798763WordSection1">
<p class="MsoNormal"><a name="m_-8828528976892798763__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Procura a função para realizar a transposta da matriz que vai dar certo. Mais simples<u></u><u></u></span></a></p>
<p class="MsoNormal"><span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></span></p>
<div>
<p class="MsoNormal"><span><b><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#17375e">João Pedro Araujo Domingues</span></b></span><span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#17375e">
</span></span><span><span style="font-size:11.0pt;color:#17375e"><u></u><u></u></span></span></p>
<p class="MsoNormal"><span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#17375e">C
</span></span><span></span><a href="tel:%2B55%2027%2099232-9582" target="_blank"><span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">+55 27 99232-9582</span></span><span></span></a><span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></span></p>
</div>
<p class="MsoNormal"><span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></span></p>
<span></span>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">De:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> R-br [mailto:<a href="mailto:r-br-bounces@listas.c3sl.ufpr.br" target="_blank">r-br-bounces@listas.<wbr>c3sl.ufpr.br</a>]
<b>Em nome de </b>Edson Lira via R-br<br>
<b>Enviada em:</b> Thursday, November 16, 2017 11:17 AM<br>
<b>Para:</b> a lista Brasileira oficial de discussão do programa R. <<a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a>><br>
<b>Assunto:</b> [R-br] Reshape<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183614">
<p class="MsoNormal" style="background:white"><span style="color:black">Bom dia caros amigos, estou trabalhando com a base de dados abaixo(somente 6 linhas):<br>
<br>
<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183758">
<p class="MsoNormal" style="background:white"><span style="color:black"><u></u> <u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183677">
<p class="MsoNormal" style="background:white"><span style="color:black">   id     UF    x2002 x2003 x2004 x2005 x2006 x2007 x2008 x2009 x2011 x2012 x2013 x2014<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183692">
1  1     Acre      192    189     311     311     333    327      338    354     357     381     337   373<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183693">
2  2  Alagoas  1251  1269  1292    1357   1413  1410    1355  1401   1344   1391   1429  1417<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183694">
3  3    Amapá    204   198   239   262   252   294   317   299   302   311   332   355<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183695">
4  4 Amazonas   958  1050  1433  1528  1502  1488  1531  1673  1689  1720  1771  1908<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183696">
5  5    Bahia  6885  6901  7167  7336  7292  7338  7665  7792  7602  7416  7530  7879<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183697">
6  6    Ceará  3705  3871  3944  4120  4143  4138  4314  4380  4121  4184  4215  4319<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183698">
<br>
<br>
<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183673">
<p class="MsoNormal" style="background:white"><span style="color:black">Estou  usando o reshape para tentar transformar as linhas em colunas, ou seja, cada uma UF seria uma coluna, e assim com as demais<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="color:black">Como gostaria que ficasse:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="color:black"><u></u> <u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184034">
<p class="MsoNormal" style="background:white"><span style="color:black">Acre Alagoas Amapá Amazonas Bahia Ceará  ano<br>
<br>
<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183674">
<p class="MsoNormal" style="background:white"><span style="color:black">192      1251                          <wbr>                   3705  2002<br>
<br>
<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184076">
<p class="MsoNormal" style="background:white"><span style="color:black">189      1269                          <wbr>                   3871  2003<br>
<br>
<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184078">
<p class="MsoNormal" style="background:white"><span style="color:black">311     1293                          <wbr>                    3944  2004<br>
<br>
<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184086">
<p class="MsoNormal" style="background:white"><span style="color:black">...       ....<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183628">
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184087">
<p class="MsoNormal" style="background:white"><span style="color:black"> <u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184089">
<p class="MsoNormal" style="background:white"><span style="color:black">Estou usando a rotina:<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184091">
<p class="MsoNormal" style="background:white"><span style="color:black"><u></u> <u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184093">
<p class="MsoNormal" style="background:white"><span style="color:black"><u></u> <u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184112">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="color:black">pea<-reshape(pea1,
<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184141">
                  varying=c("x2002","x2003","<wbr>x2004","x2005","x2006","x2007"<wbr>,<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184142">
                  "x2008","x2009","x2011","<wbr>x2012","x2013","x2014"),<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184143">
                   v.names="Medida",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184144">
                   timevar="UF",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184145">
                   times=c("Acre","Alagoas","<wbr>Amapá","Amazonas","Bahia",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184146">
                         "Ceará","Distrito Federal","Espírito Santo",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184147">
                         "Goiás","Maranhão","Mato Grosso","Mato Grosso do Sul",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184148">
                         "Minas Gerais","Pará","Paraíba","<wbr>Paraná"," Pernambuco",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184149">
                         "Piauí","Rio de Janeiro","Rio Grande do Norte",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184150">
                         "Rio Grande do Sul","Rondônia","Roraima",<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184151">
                         "Santa Catarina","São Paulo","Sergipe","Tocantins"),<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184152">
                   new.row.names=1:27,<br id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184153">
                   direction="wide")<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184160">
<p class="MsoNormal" style="background:white"><span style="color:black">que está me dando o erro:<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184237">
<p class="MsoNormal" style="background:white"><span style="color:black"><u></u> <u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184162">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="color:black">Erro em varying[, i] : número incorreto de dimensões<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184164">
<p class="MsoNormal" style="background:white"><span style="color:black">Alguém tem alguma sugesstão?<u></u><u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184210">
<p class="MsoNormal" style="background:white"><span style="color:black"><u></u> <u></u></span></p>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_184219">
<p class="MsoNormal" style="background:white"><span style="color:black">[  ]'s<u></u><u></u></span></p>
</div>
</div>
<div id="m_-8828528976892798763yui_3_16_0_ym19_1_1510346106424_183630">
<p class="MsoNormal" style="background:white"><span style="color:black">Prof. Edson Lira, Me
<br>
Estatístico<br>
Manaus-Amazonas<u></u><u></u></span></p>
</div>
</div>
</div></div></div>
</div>

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