<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Boa noite Éder,<br>
<br>
Tentei transformar a rotina criada por você em função e não
funcionou e não sei porque, poderia me ajudar?<br>
<br>
Segue CRM:<br>
<br>
### <code r><br>
require(RCurl); require(XML)<br>
url0 <-
<a class="moz-txt-link-rfc2396E" href="https://www.dropbox.com/s/znmr0lwda2y6fc5/BD_teste2.html?dl=1">"https://www.dropbox.com/s/znmr0lwda2y6fc5/BD_teste2.html?dl=1"</a><br>
url1 <-
<a class="moz-txt-link-rfc2396E" href="https://dl.dropboxusercontent.com/s/znmr0lwda2y6fc5/BD_teste2.html">"https://dl.dropboxusercontent.com/s/znmr0lwda2y6fc5/BD_teste2.html"</a><br>
<br>
page <- getURL(url1)<br>
tableFE <- readHTMLTable(page, head=T)[[1]]<br>
head(tableFE)<br>
<br>
##Agregando os resultados<br>
<br>
aggPestFE<-function(x, db=tableFE){<br>
lista <- split(tableFE, tableFE$descricao)<br>
results <- x<br>
result<-lapply(lista, function(x) aggregate(x[,7:8],
by=list(x[,3],x[,2],x[,5]), mean))<br>
return(result)<br>
}<br>
<br>
aggPestFE(tableFE)<br>
<br>
#<br>
<br>
### </code><br>
<br>
<br>
Obrigado<br>
<pre class="moz-signature" 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: (+55) 65 8132-8112 (TIM) (+55) 65 9686-6970 (VIVO)
<a class="moz-txt-link-abbreviated" href="mailto:e-mails:alexandresantosbr@yahoo.com.br">e-mails:alexandresantosbr@yahoo.com.br</a>
<a class="moz-txt-link-abbreviated" href="mailto:alexandre.santos@cas.ifmt.edu.br">alexandre.santos@cas.ifmt.edu.br</a>
Lattes: <a class="moz-txt-link-freetext" href="http://lattes.cnpq.br/1360403201088680">http://lattes.cnpq.br/1360403201088680</a>
OrcID: orcid.org/0000-0001-8232-6722
Researchgate: <a class="moz-txt-link-freetext" href="https://www.researchgate.net/profile/Alexandre_Santos10">https://www.researchgate.net/profile/Alexandre_Santos10</a>
LinkedIn: <a class="moz-txt-link-freetext" href="https://br.linkedin.com/in/alexandre-dos-santos-87961635">https://br.linkedin.com/in/alexandre-dos-santos-87961635</a>
======================================================================
</pre>
<div class="moz-cite-prefix">Em 22/01/2016 09:37, Éder Comunello
escreveu:<br>
</div>
<blockquote
cite="mid:CABmC8gmZ75MoVWPA78+hgVPxdoNF6jVN3K9JksBsR0BvronD-A@mail.gmail.com"
type="cite">
<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">require(RCurl);
require(XML)</font></div>
<div class="gmail_default"><font face="monospace, monospace">url0
<- "<a moz-do-not-send="true"
href="https://www.dropbox.com/s/znmr0lwda2y6fc5/BD_teste2.html?dl=1">https://www.dropbox.com/s/znmr0lwda2y6fc5/BD_teste2.html?dl=1</a>"</font></div>
<div class="gmail_default"><font face="monospace, monospace">url1
<- "<a moz-do-not-send="true"
href="https://dl.dropboxusercontent.com/s/znmr0lwda2y6fc5/BD_teste2.html">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">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">lista
<- split(tableFE, tableFE$descricao); head(lista)</font></div>
<div class="gmail_default"><font face="monospace, monospace">lapply(lista,
function(x) aggregate(x[,7:8], by=list(x[,2], x[,5]), mean))
</font></div>
<div class="gmail_default"><font face="monospace, monospace">###
</code></font></div>
</div>
</blockquote>
<br>
</body>
</html>