title: Changing the name of Output Function with For loop in R
body: <p>The aim is to change the name of the output file as like variable value changes in FOR loop.</p>
  
  <p>Here is my code---</p>
  
  <pre><code>library("igraph")
  dd &lt;- read.table("afterFilter(48494).txt")
  gg &lt;- graph.data.frame(dd, directed=FALSE)
  z=scan("Active_Protein.txt",character(),  sep = "\n")
  for(i in 1:877)
  
      {
      x=adjacent_vertices(gg,z[i])
      capture.output(x, file = "myfile[i].txt") 
      } 
  </code></pre>
  
  <p>// Here with the myfile as the value of i changes it shouls save like  myfile1, myfile2, myfile 3 like this.</p>
  
  <p>Please guide me how to reflect the changes in the output file as value changes in i in the FOR loop.</p>