<div dir="ltr">Alexandre,<div>no teste que fiz aqui, o problema é na leitura da tabela. A função getURL não está retornando conteúdo que a função readHTMLTable possa extrair.</div><div><br></div><div><span class="" style="border-collapse:separate;color:rgb(0,0,0);font-family:'Ubuntu Mono';font-size:14px;line-height:16px;white-space:pre-wrap;border-spacing:0px;background-color:rgb(225,226,229)"><pre tabindex="0" class="" id="rstudio_console_output" style="font-family:'Ubuntu Mono';outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:1.2;font-size:10.4pt!important;white-space:pre-wrap!important"><span class="" style="white-space:pre;color:blue">> </span><span class="" style="color:blue">URL="<a href="https://www.dropbox.com/s/foeh9oqbiqlawvg/TALHOES_AGENTE2.htm?dl=1">https://www.dropbox.com/s/foeh9oqbiqlawvg/TALHOES_AGENTE2.htm?dl=1</a>"
</span><span class="" style="white-space:pre;color:blue">> </span><span class="" style="color:blue">page <- RCurl::getURL(URL)
</span><span class="" style="white-space:pre;color:blue">> </span><span class="" style="color:blue">page
</span>[1] "<html>\r\n  <head><title>Found</title></head>\r\n  <body>\r\n    <h1>Found</h1>\r\n    <p>The resource was found at <a href=\"<a href="https://dl.dropboxusercontent.com/content_link/tkauy9obP7pgxKYpb9j5ZR2LCSUTe2iJpaULTWEN4RzdfR6AtirbNWGtt8q9Ncex/file?dl=1\">https://dl.dropboxusercontent.com/content_link/tkauy9obP7pgxKYpb9j5ZR2LCSUTe2iJpaULTWEN4RzdfR6AtirbNWGtt8q9Ncex/file?dl=1\</a>"><a href="https://dl.dropboxusercontent.com/content_link/tkauy9obP7pgxKYpb9j5ZR2LCSUTe2iJpaULTWEN4RzdfR6AtirbNWGtt8q9Ncex/file?dl=1">https://dl.dropboxusercontent.com/content_link/tkauy9obP7pgxKYpb9j5ZR2LCSUTe2iJpaULTWEN4RzdfR6AtirbNWGtt8q9Ncex/file?dl=1</a></a>;\r\nyou should be redirected automatically.\r\n\r\n<!--  --></p>\r\n    <hr noshade>\r\n    <div align=\"right\">WSGI Server</div>\r\n  </body>\r\n</html>\r\n"</pre></span></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div>Abraços,<br></div><div>Paulo<br></div></div></div></div></div>
<br><div class="gmail_quote">Em 30 de janeiro de 2016 12:16, ASANTOS <span dir="ltr"><<a href="mailto:alexandresantosbr@yahoo.com.br" target="_blank">alexandresantosbr@yahoo.com.br</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Bom dia Éder,<br>
    <br>
    <br>
           Tentei criar uma função com os comandos de leitura da tabela
    em HTML e também não funfou, posso pedir novamente sua ajuda,
    Obrigado,<br>
    <br>
    <br>
    <br>
    ##  Função de leitura da tabela<span class=""><br>
    readFE<- function (x, URL = ""){<br>
    <br></span>
    page <- getURL(URL)<span class=""><br>
    classes <- c(rep("factor", 6), rep("numeric", 4), "factor")<br>
    tableFE <- readHTMLTable(page, head=T,
    colClasses=classes)[[1]]     <br></span><span class="">
         x<-NULL<br>
         results <- x<br></span><span class="">
         results <- x<br>
        
    results<-results[!apply(results,1,function(x){any(x=="(NULL)")}),]<br></span>
         results<-subset(results, !(latitude == "0.00000000" |
    longitude == "0.00000000"))<br>
         results<br>
    }<br>
    #--#<br>
    <br>
    <br>
    <br>
    <br>
    <br>
    ## Tentativa de leitura da tabela  <br>
tableFE<-readFE(URL=<a href="https://www.dropbox.com/s/foeh9oqbiqlawvg/TALHOES_AGENTE2.htm?dl=1" target="_blank">"https://www.dropbox.com/s/foeh9oqbiqlawvg/TALHOES_AGENTE2.htm?dl=1"</a>)<br>
    head(tableFE)<br>
    #---------------<span class=""><br>
    <br>
    <br>
    <br>
    <br>
    <pre cols="72">-- 
======================================================================
Alexandre dos Santos
Proteção Florestal 
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial 
Cáceres - MT                      CEP: 78.200-000
Fone: <a href="tel:%28%2B55%29%2065%208132-8112" value="+556581328112" target="_blank">(+55) 65 8132-8112</a> (TIM)   <a href="tel:%28%2B55%29%2065%209686-6970" value="+556596866970" target="_blank">(+55) 65 9686-6970</a> (VIVO)
<a href="mailto:e-mails:alexandresantosbr@yahoo.com.br" target="_blank">e-mails:alexandresantosbr@yahoo.com.br</a> 
        <a href="mailto:alexandre.santos@cas.ifmt.edu.br" target="_blank">alexandre.santos@cas.ifmt.edu.br</a> 
Lattes: <a href="http://lattes.cnpq.br/1360403201088680" target="_blank">http://lattes.cnpq.br/1360403201088680</a>
OrcID: <a href="http://orcid.org/0000-0001-8232-6722" target="_blank">orcid.org/0000-0001-8232-6722</a> 
Researchgate: <a href="https://www.researchgate.net/profile/Alexandre_Santos10" target="_blank">https://www.researchgate.net/profile/Alexandre_Santos10</a>                       
LinkedIn: <a href="https://br.linkedin.com/in/alexandre-dos-santos-87961635" target="_blank">https://br.linkedin.com/in/alexandre-dos-santos-87961635</a>
======================================================================
</pre>
    </span><div><div class="h5"><div>Em 29/01/2016 08:41, Éder Comunello
      escreveu:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_default">
          <div class="gmail_default"><font face="verdana, sans-serif">Alexandre,
              bom dia!</font></div>
          <div class="gmail_default"><font face="verdana, sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="verdana, sans-serif">Não
              havia atentado para o problema na importação das tabelas,
              sendo necessário definir as classes. Além disso, na função
              você deve se referir a "db" antes que "tableFE" e  "x" é
              definido internamente por lapply().</font></div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default"><font face="verdana, sans-serif"><br>
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">###
              <code r></font></div>
          <div class="gmail_default"><font face="monospace, monospace">require(RCurl);
              require(XML)</font></div>
          <div class="gmail_default"><font face="monospace, monospace">url0
              <- "<a href="https://www.dropbox.com/s/znmr0lwda2y6fc5/BD_teste2.html?dl=1" target="_blank">https://www.dropbox.com/s/znmr0lwda2y6fc5/BD_teste2.html?dl=1</a>"</font></div>
          <div class="gmail_default"><font face="monospace, monospace">url1
              <- gsub("(^.*)(/s/.*)(\\?.*$)", "<a href="https://dl.dropboxusercontent.com" target="_blank"></a><a href="https://dl.dropboxusercontent.com" target="_blank">https://dl.dropboxusercontent.com</a>\\2",
              url0); url1</font></div>
          <div class="gmail_default"><font face="monospace, monospace">#
              [1] "<a href="https://dl.dropboxusercontent.com/s/znmr0lwda2y6fc5/BD_teste2.html" target="_blank">https://dl.dropboxusercontent.com/s/znmr0lwda2y6fc5/BD_teste2.html</a>"</font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br>
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">page
              <- getURL(url1)</font></div>
          <div class="gmail_default"><font face="monospace, monospace">tableFE
              <- readHTMLTable(page, head=T)[[1]]</font></div>
          <div class="gmail_default"><font face="monospace, monospace">str(tableFE)
              ### todas variáveis estão como fatores - corrigir!</font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br>
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">classes
              <- c(rep("factor", 6), rep("numeric", 4), "factor")</font></div>
          <div class="gmail_default"><font face="monospace, monospace">tableFE
              <- readHTMLTable(page, head=T, colClasses=classes)[[1]]</font></div>
          <div class="gmail_default"><font face="monospace, monospace">str(tableFE)
              ### OK!</font></div>
          <div class="gmail_default"><font face="monospace, monospace">head(tableFE)</font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br>
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">##Agregando
              os resultados</font></div>
          <div class="gmail_default"><font face="monospace, monospace">aggPestFE
              <- function(db=tableFE, key="descricao"){</font></div>
          <div class="gmail_default"><font face="monospace, monospace">lista
               <- split(db, db[key])</font></div>
          <div class="gmail_default"><font face="monospace, monospace">result
              <- lapply(lista, function(x) aggregate(x[,7:8],
              by=list(x[,3],x[,2],x[,5]), mean))</font></div>
          <div class="gmail_default"><font face="monospace, monospace">return(result)</font></div>
          <div class="gmail_default"><font face="monospace, monospace">}</font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br>
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">###
              Devido aos "defaults", obtém mesmos resultados nas três
              formas que seguem:</font></div>
          <div class="gmail_default"><font face="monospace, monospace">aggPestFE()[5]</font></div>
          <div class="gmail_default"><font face="monospace, monospace">aggPestFE(tableFE)[5]</font></div>
          <div class="gmail_default"><font face="monospace, monospace">aggPestFE(tableFE,
              "descricao")[5]</font></div>
          <div class="gmail_default"><font face="monospace, monospace">#
              $`Lagartas Desfolhadoras`</font></div>
          <div class="gmail_default"><font face="monospace, monospace">#
                Group.1           Group.2 Group.3 formiga_area
              qtd_destruido</font></div>
          <div class="gmail_default"><font face="monospace, monospace">#
              1      GN             Chale      26            0        
               62.5</font></div>
          <div class="gmail_default"><font face="monospace, monospace">#
              2      RD Corrego da Coruja      26            0        
               50.0</font></div>
          <div class="gmail_default"><font face="monospace, monospace">#
              3      GN      Aeroporto II      28            0        
               75.0</font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br>
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">###
              </code></font></div>
        </div>
        <div class="gmail_extra"><br clear="all">
          <div>
            <div>
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div>
                      <div dir="ltr"><font style="font-size:small" face="arial, helvetica, sans-serif">
                          <div>​</div>
================================================<br>
                          Éder Comunello</font>
                        <div style="font-size:small"><span style="font-family:arial,helvetica,sans-serif">PhD
                            Student in Agricultural Systems
                            Engineering (USP/Esalq)</span><br>
                        </div>
                        <div><span style="font-size:small">Brazilian
                            Agricultural Research Corporation (</span><font style="font-size:small" face="arial,
                            helvetica, sans-serif">Embrapa)</font>
                          <div style="font-size:small"><font face="arial, helvetica, sans-serif">Dourados,
                              MS, Brazil [</font>22 16.5'S, 54 49.0'W<span style="font-family:arial,helvetica,sans-serif">]</span></div>
                          <div>
                            <div><br>
                            </div>
                            <div><br>
                            </div>
                          </div>
                          <div style="font-size:small"><br>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<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/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-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>