<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Senhores, boa noite!<br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Sugiro deixar o procedimento de leitura a parte, isso porque talvez seja necessário reavaliar seus filtros.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style=""><div class="gmail_default"><font face="monospace, monospace">### <code r></font></div><div class="gmail_default"><font face="monospace, monospace">## Função para leitura da tabela HTML </font></div><div class="gmail_default"><font face="monospace, monospace">readFE <- function(url0){</font></div><div class="gmail_default"><font face="monospace, monospace"> require(RCurl); require(XML)</font></div><div class="gmail_default"><font face="monospace, monospace"> url1 <- gsub("(^.*)(/s/.*)(\\?.*$)", "<a href="https://dl.dropboxusercontent.com">https://dl.dropboxusercontent.com</a>\\2", url0); url1</font></div><div class="gmail_default"><font face="monospace, monospace"> page <- getURL(url1)</font></div><div class="gmail_default"><font face="monospace, monospace"> </font><span style="color:rgb(0,0,0);font-family:monospace,monospace;font-size:13.44px"># page <- getURL(url1, ssl.verifypeer = FALSE) ### </span><font color="#000000" face="monospace, monospace"><span style="font-size:13.44px">SSL certificate problem</span></font></div><div class="gmail_default"><span style="font-family:monospace,monospace"> classes <- c(rep("factor", 6), rep("numeric", 4), "factor")</span><br></div><div class="gmail_default"><font face="monospace, monospace"> return(readHTMLTable(page, head=T, colClasses=classes)[[1]])</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">tableFE99 <- readFE("<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>")</font></div><div class="gmail_default"><font face="monospace, monospace">str(tableFE99)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">### "filtragem" na forma que você propôs...</font></div><div class="gmail_default"><font face="monospace, monospace">results <- tableFE99[!apply(tableFE99,1,function(x){any(x=="(NULL)")}),]; results</font></div><div class="gmail_default"><font face="monospace, monospace">results <- subset(results, !(latitude == 0 | longitude == 0)); results</font></div><div class="gmail_default"><font face="monospace, monospace">nrow(results) ### 48</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><span style="font-family:monospace,monospace">### Linha 24 foi eliminada, mas poderia ser aproveitada com </span><span style="font-family:monospace,monospace">base na linha 25 (mesma lat/long?)</span></div><div class="gmail_default"><font face="monospace, monospace">tableFE99[24:25,]</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">### talvez fosse melhor restringir a busca por dados "inválidos" somente em algumas variáveis</font></div><div class="gmail_default"><font face="monospace, monospace">new <- readFE("<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>")</font></div><div class="gmail_default"><font face="monospace, monospace">new[new == "(NULL)"] <- NA</font></div><div class="gmail_default"><font face="monospace, monospace">incompl <- which(!complete.cases(new[,c(2,3,5,6)]))</font></div><div class="gmail_default"><font face="monospace, monospace">new[incompl,]</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><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif" style="font-size:small"><div style="font-family:'trebuchet ms',sans-serif;display:inline"></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 face="arial, helvetica, sans-serif" style="font-size:small">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>
<br><div class="gmail_quote">2016-01-31 12:04 GMT-03:00 ASANTOS <span dir="ltr"><<a href="mailto:alexandresantosbr@yahoo.com.br" target="_blank">alexandresantosbr@yahoo.com.br</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Obrigado Paulo,<br>
<br>
Tinham inconsistências no meu código que foram corrigidos
com suas dicas, porém a segunda função
results<-subset(results,!(latitude == "0.00000000" | longitude ==
"0.00000000")) ele não roda e continua a aparecer coordenadas 0,
sendo:<span class=""><br>
<br>
### <code r><br>
require(RCurl); require(XML)<br>
<br>
## Função de leitura da tabela<br>
readFE<- function (x, URL = ""){<br></span>
x<-NULL<span class=""><br>
url0 <- URL<br>
url1 <- gsub("(^.*)(/s/.*)(\\?.*$)",
"<a href="https://dl.dropboxusercontent.com" target="_blank">https://dl.dropboxusercontent.com</a>\\2", url0); url1<br>
page <- getURL(url1)<br>
classes <- c(rep("factor", 6), rep("numeric", 4), "factor")<br>
tableFE <- readHTMLTable(page, head=T, colClasses=classes)[[1]]<br></span>
results<-tableFE <br><span class="">
results<-results[!apply(results,1,function(x){any(x=="(NULL)")}),]<br></span>
results<-subset(results,!(latitude == "0.00000000" |
longitude == "0.00000000"))<span class=""><br>
results<br>
}<br>
#--#<br>
<br>
## Tentativa de leitura da tabela<br>
tableFE99<-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>
str(tableFE99)<br>
### </code><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 31/01/2016 10:48, Paulo Nogueira
Starzynski escreveu:<br>
</div>
<blockquote type="cite"><span>### <code r><br>
require(RCurl); require(XML)<br>
<br>
</span><span> ## Função de leitura da tabela<br>
readFE<- function (x, URL = ""){<br>
</span> url0 <- URL<span><br>
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<br>
page <- getURL(url1)<br>
</span><span> classes <- c(rep("factor", 6),
rep("numeric", 4), "factor")<br>
tableFE <- readHTMLTable(page, head=T,
colClasses=classes)[[1]] <br>
x<-NULL<br>
results <- x<br>
results <- x<br>
results<-results[!apply(results,1,function(x){any(x=="(NULL)")}),]<br>
results<-subset(results, !(latitude == "0.00000000" |
longitude == "0.00000000"))<br>
results<br>
}<br>
#--#<br>
<br>
## Tentativa de leitura da tabela <br>
</span>
tableFE99<-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>
str(tableFE99)<br>
### </code><span><br>
<br>
<br>
<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>
<div>Em 30/01/2016 14:43, Éder Comunello escreveu:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:verdana,sans-serif">Senhores, boa
tarde!</div>
<div class="gmail_default" style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif">Na forma que
sugeri é necessário alterar o link "default" do dropbox
pra acessar diretamente o arquivo.</div>
<div class="gmail_default" style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default">
<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/foeh9oqbiqlawvg/TALHOES_AGENTE2.htm?dl=1" target="_blank">https://www.dropbox.com/s/foeh9oqbiqlawvg/TALHOES_AGENTE2.htm?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"><br>
</font></div>
<div class="gmail_default"><font face="monospace,
monospace">page <- getURL(url1)</font></div>
<div class="gmail_default"><font face="monospace,
monospace"># page <- getURL(url1, ssl.verifypeer
= FALSE)</font><br>
</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)</font></div>
<div class="gmail_default"><font face="monospace,
monospace">### </code></font></div>
</div>
</div>
</div>
</div>
</blockquote>
</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>