<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Rodrigo.<br>
    <br>
    Tente usar esse script de uma "moving window" feito pelo Prof. Dr.
    Jon Grahan.<br>
    (<a class="moz-txt-link-freetext" href="http://www.math.umt.edu/graham/stat544/movewin.r">http://www.math.umt.edu/graham/stat544/movewin.r</a>). Não sei se o
    link ainda está ativo.<br>
    Nesse script vc. define o tamanho (m) da janela móvel (nas direções
    x e y), se haverá sobreposição entre janelas adjacentes (overlap) e
    a variável em foco (velocidade?) <br>
    Ele retorna o número de observações em cada janela, a média/desvio
    padrão das observações ali encontradas.<br>
    <br>
    Obs. <br>
    1. as coordenadas de seus dados deverão estar em UTM (coordenadas
    métricas).<br>
    2. as classes que vc. possui deverão ser "traduzidas" num
    espaçamento regular fixo em x e em y (o tamanho da janela)  
    <br>
    <br>
    FCosta<br>
     <br>
    <div class="moz-signature"><br>
      <br>
    </div>
    <div class="moz-cite-prefix">Em 22/4/2016 16:52, Rodrigo Campos
      escreveu:<br>
    </div>
    <blockquote
cite="mid:CA+3Y+9rXavn5rJwW8pkaFY8CmQnR38H+bxU13vZ0QNJ+9dmamg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Olá Leonardo
        <div><br>
        </div>
        <div>Boa tarde. Obrigado pelo retorno.</div>
        <div><br>
        </div>
        <div>Acredito que possa compreender melhor a partir deste email.</div>
        <div><br>
        </div>
        <div>Abaixo, meu arquivo data.frame <span
            style="font-size:12.8px">("full_data.txt")</span> com dim()
          = 298995 observações e 6 variáveis:</div>
        <div><br>
        </div>
        <div>
          <table style="border-collapse:collapse;width:370pt" border="0"
            width="494" cellpadding="0" cellspacing="0">
            <colgroup><col style="width:48pt" width="64"> <col
                style="width:68pt" width="91"> <col style="width:48pt"
                span="4" width="64"> <col style="width:62pt" width="83">
            </colgroup><tbody>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;width:48pt" height="20"
                  width="64"> </td>
                <td class="" style="width:68pt" width="91">cod_barco</td>
                <td class="" style="width:48pt" width="64">lat_dec</td>
                <td class="" style="width:48pt" width="64">long_dec</td>
                <td class="" style="width:48pt" width="64">mes</td>
                <td class="" style="width:48pt" width="64">ano</td>
                <td class="" style="width:62pt" width="83">velocidade</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt" height="20">1</td>
                <td class="">892</td>
                <td class="">-23.0086</td>
                <td class="">-44.3131</td>
                <td class="">8</td>
                <td class="">2015</td>
                <td class="">2.4</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt" height="20">2</td>
                <td class="">445</td>
                <td class="">-23.0086</td>
                <td class="">-44.3131</td>
                <td class="">8</td>
                <td class="">2015</td>
                <td class="">3.7</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt" height="20">3</td>
                <td class="">67</td>
                <td class="">-23.0086</td>
                <td class="">-44.3131</td>
                <td class="">8</td>
                <td class="">2015</td>
                <td class="">3.1</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt" height="20">4</td>
                <td class="">223</td>
                <td class="">-23.0086</td>
                <td class="">-44.3131</td>
                <td class="">8</td>
                <td class="">2015</td>
                <td class="">8.9</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt" height="20">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt" height="20">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
                <td class="">...</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt" height="20">298995</td>
                <td class="">678</td>
                <td class="">-23.0234</td>
                <td class="">-44.4543</td>
                <td class="">12</td>
                <td class="">2015</td>
                <td class="">4.5<br>
                </td>
              </tr>
            </tbody>
          </table>
          <br>
          Gostaria de obter a frequência de observações (número de
          amostras) por classe de latitude e longitude. </div>
        <div>As classes estão pré-estabelecidas em outro arquivo txt
          independente (<span style="font-size:12.8px">"lat_long_classes.txt");
            no qual </span>tenho 1350 classes de pares de coordenadas
          (lat e long), conforme demostrado abaixo (dim()=1350
          observações e 2 variáveis):</div>
        <div><br>
        </div>
        <div>
          <table style="border-collapse:collapse;width:144pt" border="0"
            width="192" cellpadding="0" cellspacing="0">
            <colgroup><col style="width:48pt" span="3" width="64"> </colgroup><tbody>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;width:48pt" height="20"
                  width="64"> </td>
                <td class="" style="border-left-style:none;width:48pt"
                  width="64">Lat_class</td>
                <td class="" style="border-left-style:none;width:48pt"
                  width="64">Long_class</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">1</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-44.4251</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-23.6433</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">2</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-44.4201</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-23.6433</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">3</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-44.4152</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-23.6432</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">4</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-44.43</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-23.6388</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">5</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-44.4251</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-23.6388</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">6</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-44.4202</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-23.6387</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">...</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">...</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">...</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">...</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">...</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">...</td>
              </tr>
              <tr style="height:15pt" height="20">
                <td class="" style="height:15pt;border-top-style:none"
                  height="20">1350</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-44.4349</td>
                <td class=""
                  style="border-top-style:none;border-left-style:none">-23.6343</td>
              </tr>
            </tbody>
          </table>
          <br>
        </div>
        <div>Alguém saberia uma dica de como posso gerar a frequência
          (n) de observações do meu dataset "full_data.txt" conforme as
          classes de pares de latitude e longitude determinadas em outro
          arquivo ("<span style="font-size:12.8px">lat_long_classes.txt")?
            Ou seja, preciso agregar 298995 amostras dentro de 1350
            classes estabelecidas em outro data.frame!</span></div>
        <div><br>
        </div>
        <div>Obrigado.</div>
        <div><br>
        </div>
        <div>Rodrigo    </div>
        <div><br>
        </div>
        <div> </div>
        <div><br>
          <br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2016-04-22 16:01 GMT-03:00 Leonardo
          Ferreira Fontenelle <span dir="ltr"><<a
              moz-do-not-send="true"
              href="mailto:leonardof@leonardof.med.br" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:leonardof@leonardof.med.br">leonardof@leonardof.med.br</a></a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div>
              <div style="font-family:Arial">Sua explicação não é
                detalhada o suficiente para a gente dar uma dica que
                funcione sem adaptações. O cut() pode ser usado para
                categorizar variáveis numéricas, e o merge (), para
                mesclar duas data.frames.</div>
              <div style="font-family:Arial"> </div>
              <div>
                <div><a moz-do-not-send="true"
                    href="http://lattes.cnpq.br/9234772336296638"
                    title="Currículo Lattes" target="_blank">Leonardo
                    Ferreira Fontenelle</a><br>
                </div>
              </div>
              <div>
                <div class="h5">
                  <div> </div>
                  <div> </div>
                  <div>Em Qui 14 abr. 2016, às 09:30, Rodrigo Campos
                    escreveu:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div dir="ltr">
                      <div style="font-family:Arial">Amigos usuários do
                        R,<br>
                      </div>
                      <div>
                        <div style="font-family:Arial"> </div>
                        <div>Bom dia.<br>
                        </div>
                        <div> </div>
                        <div>Tenho um data.frame ("full_data.txt") com
                          cerca de 300 mil observações de posições
                          geográficas (em duas colunas distintas com as
                          variáveis latitude (y) e longitude (x) em
                          decimal de grau).<br>
                        </div>
                        <div> </div>
                        <div>Tenho um segundo arquivo
                          ("lat_long_classes.txt") apenas com <u>classes
                            de pares de coordenadas</u> (também em
                          decimal de grau). São 1350 classes de lat long
                          (como centroides de um grid! Posições
                          equidistantes!).<br>
                        </div>
                        <div> </div>
                        <div>Alguém poderia me dar uma dica de como
                          posso obter as frequências de observações
                          (constantes em "full_data.txt")  por classe de
                          coordenadas (conforme "lat_long_classes.txt")?<br>
                        </div>
                        <div> </div>
                        <div>Obrigado.<br>
                        </div>
                        <div> </div>
                        <div>Rodrigo<br>
                        </div>
                        <div>
                          <div style="font-family:Arial"> </div>
                          <div> </div>
                          <div style="font-family:Arial">-- <br>
                          </div>
                          <div>
                            <div dir="ltr">
                              <div style="font-family:Arial">Rodrigo
                                Campos<br>
                              </div>
                              <div>
                                <div style="font-family:Arial"> </div>
                                <div><span
                                    style="background-color:rgb(255,255,255)"><span
                                      style="font-size:x-small"><a
                                        moz-do-not-send="true"
                                        href="http://www.pleuston.com"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="http://www.pleuston.com">www.pleuston.com</a></a></span></span><br>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div><u>_______________________________________________</u><br>
                </div>
                <div>R-br mailing list<br>
                </div>
                <div><a moz-do-not-send="true"
                    href="mailto:R-br@listas.c3sl.ufpr.br"
                    target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
                </div>
                <div><a moz-do-not-send="true"
                    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>
                </div>
                <div>Leia o guia de postagem (<a moz-do-not-send="true"
                    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>
                </div>
              </blockquote>
              <div style="font-family:Arial"> </div>
            </div>
            <br>
            _______________________________________________<br>
            R-br mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
            <a moz-do-not-send="true"
              href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
              rel="noreferrer" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
            Leia o guia de postagem (<a moz-do-not-send="true"
              href="http://www.leg.ufpr.br/r-br-guia" rel="noreferrer"
              target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e
            forneça código mínimo reproduzível.<br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">
          <div dir="ltr">Rodrigo Campos
            <div><br>
              <div><font style="background-color:rgb(255,255,255)"
                  size="1" color="#999999"><a moz-do-not-send="true"
                    href="http://www.pleuston.com" target="_blank">www.pleuston.com</a></font></div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
R-br mailing list
<a class="moz-txt-link-abbreviated" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a>
<a class="moz-txt-link-freetext" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a class="moz-txt-link-freetext" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forne�a c�digo m�nimo reproduz�vel.</pre>
    </blockquote>
    <br>
  </body>
</html>