<html><head></head><body><div class="ydp523c4ea8yahoo-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;">Prezados boa tarde!!! Lá vou eu incomodar os amigos, rs... Estou fazendo uma macro para baixar dados "*.csv" de uma fonte URL, com um formato semelhante a esse (desculpa, não consegui fazer um reproduzível), onde k1 designa meses do ano e k2 é um conjunto de cinco (ou mais) substâncias: </div><font color="#808080" style="font-size: 16px; font-family: bookman old style, new york, times, serif;"><font size="1">baixa_bancos<-function(k1,k2){<br>dados<-read.csv2(paste('http://.../arquivo_m", k1 ,"_s", k2 ,".csv'",sep=""),<br>header=T, sep="|", dec =".", encoding = "UTF-8")<br>} </font><br></font><span style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><font size="3" style="background-color: inherit;"><br></font></span></div><div style=""><span style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><font size="3" style="background-color: inherit;">A chamada da macro fica algo assim:</font></span><br style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><font color="#808080" style="font-size: x-small; font-family: bookman old style, new york, times, serif;">a<-seq(1:12);b<-seq(1:5)<br>for(i in 1:length(a))<br>for(j in 1:length(b))<br>{<br>k1<-a[[i]]<br>k2<-b[[j]]<br>baixa_bancos(k1,k2)<br>}</font><br style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><div style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><br></div><div style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;">A dúvida: se eu executar assim a macro, <font color="#cd232c"><b>dados</b></font> vai sempre ser subscrito pelas informações de outro mês e outra substância. Assim, queria que o arquivo (tabela) fosse salvo no ambiente RStudio de forma similar abaixo (obs: sei que não está certo, é mais para entender o que estou precisando):</div><div dir="ltr" data-setdir="false" style="font-size: 16px; font-family: bookman old style, new york, times, serif;"><span style="font-size: x-small;"><font color="#808080" style="background-color: inherit;"><b>paste("arquivo_m",k1,"_s",k2)<-dados</b></font></span><br></div><div dir="ltr" data-setdir="false" style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><br></div><div dir="ltr" data-setdir="false" style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;">E em seguida <b>reunir todos eles via rbind</b> ou outro comando. Consegui explicar certo? Se sim, alguém saberia como resolver?</div><div dir="ltr" data-setdir="false" style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><br></div><div dir="ltr" data-setdir="false" style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;">Obrigado e bom fim-de-semana!!!</div><div dir="ltr" data-setdir="false" style="font-size: 16px; color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif;"><br></div><i id="ydpcf278505yui_3_16_0_1_1497025264182_38508" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif;"><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><div class="ydp523c4ea8signature" 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 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>