<div dir="ltr"><br clear="all"><div><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">Olá
pessoal,<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><font face="times new roman, serif"><span style="font-size:12pt">eu
estou trabalhando no R com conjunto de dados muito grande (numa fase de
teste) e a tendência é que essa banco de dados aumente ainda mais, numa </span><span style="font-size:16px">próxima</span><span style="font-size:12pt"> etapa que não será teste. E em algumas
de minhas programações, o R retornou mensagem de aviso dizendo que não podia
alocar o vetor de tamanho de 3.7 GB.</span><span style="font-size:12pt"></span></font></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">Dessa
forma, ao invés de concatenar uma matriz em baixo da outra num objeto criado
(onde ele me retorna que não foi capaz de armazenar tudo), eu gostaria de ir
salvando cada matriz gerada de resultado no diretório local.<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">Minha
dúvida, é como criar esse algoritmo de forma que eu consiga salvar dentro de um
loop, data.frames com nomes diferentes, sem que ocorra substituição de um
data.frame pelo outro.<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">Eu
criei um código mínimo (de forma que vocês possam me dar alguma ajuda), e eu
possa adaptar para a situação que estou trabalhando. Esse código está
substituindo o data.frame a cada rodada dentro do loop. Eu queria que o nome do
data.frame alterasse para que guardasse todos os resultados com nomes
diferentes, acompanhando a variação do loop (1,2, ..., N):<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">library(MASS)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">salva_BD_i
<- function(N){<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">  for (i in 1:N){<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    p 
<- 30    # numero de variáveis
a serem geradas (p)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    ME    
<- rep(1, p)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    rho   
<- 0.5 # correlacao <span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    sigma2 <- 1<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    sigma 
<- sigma2 * ((1-rho)*diag(p)+rho*matrix(1, p, p))<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    n <- 10000<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    Y 
<- mvrnorm(n, ME, sigma)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">    </span><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">write.table(Y,
"i.txt")<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">    </span><span style="font-size:12pt;font-family:"times new roman",serif">}<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">}<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">N=30000<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">salva
= salva_BD_i(N)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;text-indent:35.4pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">Numa
segunda etapa, eu precisaria de ler (puxar todos os data.frame para dentro de
um objeto do R, num loop. Também criei um código mínimo executável, mas
acontece o mesmo, o índice do loop não é processado dentro do read.table:<span></span></span></p>

<pre style="line-height:11.25pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;word-break:break-all"><span class="gmail-gghfmyibcpb"><span lang="EN-US" style="font-family:"lucida console";color:blue">> </span></span><span class="gmail-gghfmyibcob"><span lang="EN-US" style="font-family:"lucida console";color:blue">setwd('C:\\Users\\Adriele\\ teste')</span></span><span lang="EN-US" style="font-family:"lucida console";color:black"><span></span></span></pre>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:11.25pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;word-break:break-all"><span lang="EN-US" style="font-size:10pt;font-family:"lucida console";color:blue">> dir()<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:11.25pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;word-break:break-all"><span lang="EN-US" style="font-size:10pt;font-family:"lucida console";color:black"> [1]
"1.txt"   "2.txt"     "3.txt"     "4.txt"     "5.txt"     "6.txt"     "7.txt"     "8.txt"     "9.txt"   "10.txt" "Adriele.R"<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">Leia_BD_i
<- function(N){<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">  </span><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">aux= c()<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">  for (i in
1:N){<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">    BD_i <-
read.table("i.txt",  header =
TRUE)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">    media =
apply(BD_i, 2, mean)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">    aux =
rbind(aux, media)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">  }<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span lang="EN-US" style="font-size:12pt;font-family:"times new roman",serif">  return(medias
= aux)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">}<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif"><span> </span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">N=10<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"times new roman",serif">Leitura
= Leia_BD_i(N)<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><br></p>

<pre style="line-height:11.25pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;word-break:break-all"><span class="gmail-gghfmyibgob"><span lang="EN-US" style="font-family:"lucida console";color:rgb(197,6,11)">Error in file(file, "rt") : cannot open the connection<span></span></span></span></pre><pre style="line-height:11.25pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;word-break:break-all"><span class="gmail-gghfmyibgob"><span lang="EN-US" style="font-family:"lucida console";color:rgb(197,6,11)">In addition: Warning message:<span></span></span></span></pre><pre style="line-height:11.25pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;word-break:break-all"><span class="gmail-gghfmyibgob"><span lang="EN-US" style="font-family:"lucida console";color:rgb(197,6,11)">In file(file, "rt") : cannot open file 'i.txt': No such file or directory</span></span><span lang="EN-US" style="font-family:"lucida console";color:black"><span></span></span></pre></div><font face="times new roman, serif"><span style="font-size:16px">Agradeço se alguém puder contribuir,</span></font><div><br></div><div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div style="font-family:times,serif;margin:0cm 0cm 0.0001pt;font-size:16px"><span style="white-space:pre">       </span>Adriele Giaretta Biase.</div><div style="font-family:times,serif;margin:0cm 0cm 0.0001pt;font-size:16px"><span style="white-space:pre">      </span>Mestre em  Estatística e Experimentação Agropecuária - UFLA. <br><span style="white-space:pre">        </span>Doutora em Estatística e Experimentação Agronômica - ESALQ/ USP</div><div style="font-family:times,serif;margin:0cm 0cm 0.0001pt;font-size:16px"><span style="font-size:12pt;white-space:pre">  </span><span style="font-size:12pt">Contato: (19) 98861-0619.</span></div></div></div></div></div></div>
</div></div>