title: How can I save the same parameters from different for loops?
body: <p>I have a for loop that works in function of <code>x</code> and <code>y</code>. </p>
  
  <p>So, finally the for loop gives me results like <code>z</code>, <code>a</code>, <code>b</code>. </p>
  
  <p>I want to save <code>x</code>, <code>y</code> , <code>z</code>, <code>a</code> and <code>b</code> sequentially, changing x and y.</p>
  
  <p>First, I did this to save the first parameters <code>(x=0.1, y=10)</code> and its results <code>("yes", z, a , b)</code>.</p>
  
  <pre><code>saveRDS(paste(x,y,"yes",z,a,b),file=paste("exer.RData"))
  readRDS(file="exer.RData")
  # [1] 0.2 10 yes 0.675791369732277 -0.52120086986903 0.353252113912809
  </code></pre>
  
  <p>And then, to save the next results, I tried to do this:</p>
  
  <pre><code>result&lt;-NULL
  result&lt;-c(result,readRDS(file="tfm.RData"))
  </code></pre>
  
  <p>And get this error:</p>
  
  <pre><code>Error: object 'result' not found
  </code></pre>
  
  <p>I think that it's necesary to use a for loop and not the above, I tried this:</p>
  
  <pre><code>res&lt;-paste(x,y,"yes",z,a,b)
  for(i in 1:length(res)){
    saveRDS(i,file=paste0(names(res[i]),".rda"))}
  </code></pre>
  
  <p>I'm new in R, I hope you can help me. Thanks! </p>