Thiago,<div><br></div><div>Escrevi uma função, não muito elegante (não genérica), que faz isso que você quer, mas sem precisar usar o CEP.</div><div><br></div><div>entre com um data frame e a indicação da coluna onde está o endereço completo. e.g.:</div>
<div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">> library(RCurl)</font></div><div><font class="Apple-style-span" face="'courier new', monospace">> library(RJSONIO)</font></div>
</div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">> dataframeAddress</font></div><div><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; "><span class="Apple-style-span" style="line-height: 15px; text-align: -webkit-left; white-space: pre-wrap; "><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace"> address
1 Rua Fulano de tal, 123, Nome da Cidade
2 Rua Ciclano, 312, Nome da Cidade</font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace"><br></font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace">> latlng(dataframeAddress, 1) # Nome do data frame e a coluna onde está o endereço</font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace"><br></font></pre></span></span><span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap; "><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace"> address lat lng
1 Rua Fulano de tal, 123, Nome da Cidade 10.00000 -100.00000
2 Rua Ciclano, 312, Nome da Cidade -10.00000 10.00000</font></pre></span><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; "><span class="Apple-style-span" style="text-align: -webkit-left; "><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace"><br></font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace">#-</font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace"># Funcão</font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace">#------------------</font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.3; ">
<font class="Apple-style-span" face="'courier new', monospace"><br></font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap; "><font class="Apple-style-span" face="'courier new', monospace">latlng <- function(address, column) {
readyAddress <- data.frame(formatted=c(gsub(' ', '+', address[, column])))
prePart <- "<a href="http://maps.google.com/maps/api/geocode/json?address=">http://maps.google.com/maps/api/geocode/json?address=</a>"
posPart <- "&sensor=true"
request <- paste(prePart, readyAddress$formatted, posPart, sep="")
json <- character(length(request))
store <- data.frame(lat=numeric(length(request)), lng=numeric(length(request)))
for (i in 1:length(request)) {
json[i] <- getURL(url=request[i])
temp <- fromJSON(json[i])
latLng <- temp$results[[1]]$geometry$location
store[i, ] <- latLng
}
result <- cbind(address[, column], store)
colnames(result) <- c("address", "lat", "lng")
result
}</font></span></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<font class="Apple-style-span" face="'Lucida Console'"><span class="Apple-style-span" style="font-size: 12px; line-height: 15px; white-space: pre-wrap;"><br></span></font></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap; "><font class="Apple-style-span" face="arial, helvetica, sans-serif">---</font></span></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap; "><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></span></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap; "><font class="Apple-style-span" face="arial, helvetica, sans-serif">Espero que seja útil.</font></span></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap; "><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></span></pre><pre tabindex="0" class="GD40030CLR" style="outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap; "><font class="Apple-style-span" face="arial, helvetica, sans-serif">Abs,</font></span></pre></span></span></div><div><br clear="all">Fabrício.<div>
<a href="http://vizzual.net" target="_blank">http://vizzual.net</a></div><br>
<br><br><div class="gmail_quote">Em 6 de agosto de 2011 04:31, Mauro Sznelwar <span dir="ltr"><<a href="mailto:sznelwar@uol.com.br">sznelwar@uol.com.br</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>
<div bgcolor="#ffffff">
<div align="justify"><font face="Arial" color="#0000ff" size="3">Tem razão em parte, em
cetas ocasiões dá em Lima no Perú, e outras em Goiânia. Deve ter alguma
limitação de uso esta rotina</font></div>
<blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:#000000 2px solid;margin-right:0px"><div class="im">
<div style="font:10pt arial">Coloquei o CEP de duas ruas conhecidas, ex:
83005150 e funcionou perfeitamente.</div>
</div><div dir="ltr"><div class="im">
<div><br></div>
<div>Se colocar o CEP com o traço, 83005-150 vai parar em Lima no Perú,
hehehehe.</div>
<div><br></div>
</div><div>Daniel<br>
<div><font face="Arial"></font><br>
</div>
<div>
<div>
<div>
<div>
<div align="justify"><font face="Arial" color="#0000ff">Rodei este script, e deu em
Juíz de Fora, MG. Rodei o meu cep 01423001, em São Paulo-SP deu em Lima no
Perú. Quero saber se existe algum jeito de entrar ou está furado o
programa.</font>.</div></div></div></div></div></div></div></blockquote></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" 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" 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>