<div dir="ltr">

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">Prezados,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Tenho dados
(em torno de 60.000)  de 400 estações meteorológicas. Fiz um programa que
lê todas de uma vez. Mas, não consigo concatenar os dados para representar só
um Gráfico boxplot de cada região.</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Me
ensinaram estes comandos, que não consegui usar o “rbind” ao meu caso (com
muitos arquivos). <br></span></p><p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Aliás não consegui nem guardar os arquivos lidos (no caso
prec e chuvav), não consigo colocar número neles. <br></span></p><p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Os arquivos não têm o mesmo comprimento (por conta dos dados faltantes, dias sem observações).<br>
</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Por favor,
alguém pode me ajudar?</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Abraço,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif""> </span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">setwd("F:/MyStuff/Coursera/StatsCourse/")</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">fil1<-"weather1.txt"</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">fil2<-"weather2.txt"</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">weather1<-read.csv(fil1, header=TRUE)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">weather2<-read.csv(fil2, header=TRUE)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">head(weather1)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">head(weather2)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"># Combine weather records</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">weather<-rbind(weather1, weather2)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"># Boxplot on TempMaxima</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">boxplot(weather[, "TempMaxima"])</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"> </span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Segue uma
simplificação do programa (para uma variável)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">x1=list.files()</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">i=length(x1)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">nome <- vector(mode="character",length=i)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">listarq <- vector(mode="list",length=i)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"> for(t in 1:i){</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">listarq[[t]] <- read.table(paste(x1[t]),
header=TRUE, sep=",", na.strings="NA", dec=".",
strip.white=TRUE)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">  nome[t] <- substr(paste(x1[t]),start=1,stop=(nchar(x1[t])-4))</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">   </span><span style="font-size:9pt;font-family:"Verdana","sans-serif"">lugar <- getwd()</span></p>


<p><span style="font-size:9pt;font-family:"Verdana","sans-serif""> 
nome2 <- substr(nome[t],start=1,stop=(nchar(lugar)))</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">  
if (nome2=="") return();</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif""> diretorio.nome
<- strsplit(lugar,"/")[[1]]</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">diretorio.nome1
<- diretorio.nome[1]</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif""> </span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">for(j in 2:(length(diretorio.nome)-1))</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">diretorio.nome1<-paste(diretorio.nome1,diretorio.nome[j],sep="/")</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif""> </span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">est <-
listarq[[t]][,1]</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">tempdma
<- listarq[[t]][,2]</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">prec <-
listarq[[t]][,4]</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">h=length(est)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">tempdma
<- as.character(tempdma)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">mes <-
vector(mode="character",length=h)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">mes 
<- substr (paste(tempdma),start=4,stop=(nchar(tempdma)-5))</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif""> chuvav
<-  vector(mode="numeric")</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif""> pre1
<- paste(diretorio.nome1,"prec.jpg", sep="/")</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">prec_ver
<- paste(diretorio.nome1,"precv.jpg", sep="/")</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">prec <- prec[prec > 0.25]</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"> </span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">for(jj in 1:h){</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">nmes  <-  as.numeric(mes[jj])</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"></span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">aux  <- prec[jj]</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">if(!<a href="http://is.na">is.na</a>(aux)){</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">if (aux >= 0.25){</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">if (nmes ==12| nmes ==1| nmes ==2){</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">chuvav[jj]<-
aux</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">}</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">}</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">}</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">}</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">boxplot(prec, range=0,ylim=c(0,200), ylab =
"Precipitação (mm)")</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"> dev.print(jpeg, filename= pre1, width=25,
height=17, pointsize=17, units="cm", res=80)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"> dev.off()</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US">boxplot(chuvav, range=0,ylim=c(0,200), ylab =
"Precipitação (mm)")</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"> dev.print(jpeg, filename= prec_ver, width=25,
height=17, pointsize=17, units="cm", res=80)</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"" lang="EN-US"> </span><span style="font-size:9pt;font-family:"Verdana","sans-serif"">dev.off()</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">}</span></p><p><span style="font-size:9pt;font-family:"Verdana","sans-serif""><br></span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Exemplo dos
dados:</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Estacao,Data,Hora,Precipitacao,TempMaxima,TempMinima,UmidadeRelativa,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,01/01/1961,0000,,32.5,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,01/01/1961,1200,,,22.1,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,02/01/1961,0000,,32.9,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,02/01/1961,1200,0,,22.1,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,03/01/1961,0000,,33.3,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,03/01/1961,1200,0,,23.1,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,04/01/1961,0000,,33.3,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,04/01/1961,1200,0,,23.3,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,05/01/1961,0000,,32.9,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,05/01/1961,1200,0,,20.7,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,06/01/1961,0000,,33.1,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,06/01/1961,1200,0,,20.7,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,07/01/1961,0000,,33.5,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">82294,07/01/1961,1200,0,,22.1,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">  <br></span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">Estacao,Data,Hora,Precipitacao,TempMaxima,TempMinima,UmidadeRelativa,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,01/01/1961,0000,,20.2,,,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,01/01/1961,1200,,,14.8,94,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,01/01/1961,1800,,,,89,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,02/01/1961,0000,,20.3,,98,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,02/01/1961,1200,16.3,,15,98,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,02/01/1961,1800,,,,100,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,17/01/1961,0000,,23.1,,100,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,17/01/1961,1200,15.5,,13.6,100,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,17/01/1961,1800,,,,70,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,18/01/1961,0000,,24.2,,97,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,18/01/1961,1200,0,,11.7,82,</span></p>

<p><span style="font-size:9pt;font-family:"Verdana","sans-serif"">83714,18/01/1961,1800,,,,65,</span></p>

</div>