title: error saving: Error in gzfile(file, "wb") : cannot open the connection
body: <p>I am trying to run a LDA topic analysis on Rstudio 3.3.0. I am at the following step but keep getting the error: </p>
  
  <p>Error in gzfile(file, "wb") : cannot open the connection
  In addition: Warning message:
  In gzfile(file, "wb") :
    cannot open compressed file 'results/Gibbs_5_1.rda', probable reason 'No such file or directory'</p>
  
  <p>There is a problem while saving. </p>
  
  <pre><code>D &lt;- nrow(data)
  folding &lt;- sample(rep(seq_len(10), ceiling (D))[seq_len(D)]) 
  for (k in topics)
  {
    for (chain in seq_len(10))
       {
      FILE &lt;- paste("Gibbs_", k, "_", chain, ".rda", sep = "")
  
      training &lt;- LDA(data[folding != chain,], k = k,
      control = list(seed = SEED,
      burnin = BURNIN, thin = THIN, iter = ITER, best= BEST),
      method = "Gibbs")
      best_training &lt;- training@fitted[[which.max(logLik(training))]]
      testing &lt;- LDA(data[folding == chain,], model = best_training,
      control = list(estimate.beta = FALSE, seed = SEED,
      burnin = BURNIN, 
      thin = THIN, iter = ITER, best = BEST))
  
      save(training, testing, file = file.path("results", FILE))
    }
  }
  </code></pre>
  
  <p>There is enough workspace on my computer, and I tried to restart r several times and yes I looked at the other questions but none of the solutions seem to work. </p>
  
  <pre><code>&gt; sessionInfo()
  R version 3.3.0 (2016-05-03)
  Platform: x86_64-apple-darwin13.4.0 (64-bit)
  Running under: OS X 10.10.5 (Yosemite)
  
  locale:
  [1] C
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] topicmodels_0.2-4  wordcloud_2.5      RColorBrewer_1.1-2 slam_0.1-35        SnowballC_0.5.1   
  [6] tm_0.6-2           NLP_0.1-9         
  
  loaded via a namespace (and not attached):
  [1] modeltools_0.2-21 parallel_3.3.0    tools_3.3.0       Rcpp_0.12.5       stats4_3.3.0    
  </code></pre>
  
  <p>I am a beginner in R and I follow a book to conduct the analysis for my master thesis.</p>
  
  <p>Thanks! </p>