<html><head></head><body><div class="ydpe9efe48cyahoo-style-wrap" style="font-family: bookman old style, new york, times, serif; font-size: 16px;"><div dir="ltr" data-setdir="false" style=""><div style=""><div style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;" dir="ltr" data-setdir="false">Prezados, bom dia!!! Novamente o chato rs. De forma direta, eu tenho essa consulta que eu fiz com essas packages:</div><div style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><br></div><div style="font-family: bookman old style, new york, times, serif;"><font color="#808080" style="" size="2">library("httr")</font></div><div style="font-family: bookman old style, new york, times, serif;"><font color="#808080" size="2">library("jsonlite")</font></div><div style="font-family: bookman old style, new york, times, serif;"><font color="#808080" size="2">library("data.table")<br></font></div><div style=""><br></div></div></div><div dir="ltr" data-setdir="false" style=""><div dir="ltr" data-setdir="false" style=""><div style=""><div dir="ltr" data-setdir="false" style=""><div style=""><div style=""><font color="#808080" size="2">url<-str_c("https://servicodados.ibge.gov.br/api/v1/localidades/estados/RJ/regioes-metropolitanas")</font></div><div style=""><font color="#808080" size="2">r<-GET(url)</font></div><div style=""><span style="color: rgb(128, 128, 128); font-size: small;"><br></span></div><div style=""><span style="color: rgb(128, 128, 128); font-size: small;">r_text<-content(r, </span><span style="color: rgb(128, 128, 128); font-size: small;">as="text"</span><span style="color: rgb(128, 128, 128); font-size: small;">)</span><br></div><div style=""><font color="#808080" size="2">data_json<-fromJSON(r_text, flatten=TRUE)</font></div><div style=""><font color="#808080" style="" size="2">data_json<-as.data.frame(data_json)</font></div></div><br></div></div>Em resumo, dessa API do IBGE, busquei as informações das regiões metropolitanas, e as importei para dentro do R em dataframe, para realizar uma análise.</div><div dir="ltr" data-setdir="false" style=""><br></div><div dir="ltr" data-setdir="false" style="">Problema: quando ele vêm, ele está com a seguinte cara:</div><div dir="ltr" data-setdir="false" style=""><br></div><div dir="ltr" data-setdir="false" style=""><img title="Imagem incorporada" alt="Imagem incorporada" src="cid:0aa4cd89-68aa-8a58-dd79-122e1200b94e@yahoo.com" class="yahoo-inline-image" draggable="false" style="max-width: 800px; width: 100%;" data-id="<0aa4cd89-68aa-8a58-dd79-122e1200b94e@yahoo.com>"><br><span></span>Sendo que em municipios, está a informação dos municipios. Eu até consigo (via comando r<span>bindlist) "quebrar" esse info de municipios assim: </span></div><div dir="ltr" data-setdir="false" style=""><span style="color: rgb(128, 128, 128); font-size: small;">data_json_municipios<-rbindlist(data_json$municipios)</span><br></div><div dir="ltr" data-setdir="false" style=""><div><div><br></div><div dir="ltr" data-setdir="false">Mas eu queria, no mesmo banco de origem (chamado aqui de data_json), expandir para o banco essa informações dos municípios.<br></div></div></div><div dir="ltr" data-setdir="false" style=""><span><br></span></div><div dir="ltr" data-setdir="false" style=""><span>Alguém poderia me ajudar nessa? Obrigado!!!  </span>  </div></div><div class="ydpe9efe48csignature" style="font-size: 16px;"><div style="font-family:Helvetica, Arial, sans-serif;font-size:16px;"><div style="margin-bottom:0.0001pt;padding:0px;line-height:normal;background:white;"><i><span style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;"><br></font></span></i></div><div style="margin-bottom:0.0001pt;padding:0px;line-height:normal;background:white;"><i id="ydpcf278505yui_3_16_0_1_1497025264182_38508"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38507" style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;">Diogo Jerônimo</font></span></i><br></div><div style="margin-bottom:0.0001pt;padding:0px;line-height:normal;background:white;"><i id="ydpcf278505yui_3_16_0_1_1497025264182_38430"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38429" style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;">Bacharel em Ciências Estatísticas - ENCE/IBGE</font></span></i></div><div style="margin-bottom:0.0001pt;padding:0px;line-height:normal;background:white;"><i id="ydpcf278505yui_3_16_0_1_1497025264182_38309"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38308" style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;">Mestre em Metrologia - PUC-Rio/PósMQI</font></span></i></div><div style="margin-bottom:0.0001pt;padding:0px;line-height:normal;background:white;"><i id="ydpcf278505yui_3_16_0_1_1497025264182_38323"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38322" style="line-height:17.12px;color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" id="ydpcf278505yui_3_16_0_1_1497025264182_38695" style="background-color: inherit;">http://lattes.cnpq.br/8996149312896520</font></span></i></div></div></div></div></body></html>