title: Write many files in a for loop
body: <p>I have sample data like this</p>
  
  <pre><code>df &lt;- data.frame(name = rep(letters[1:7], each = 24), salary = runif(24*7, 100, 200))
  </code></pre>
  
  <p>I wanted to separate each name with their salaries</p>
  
  <pre><code>lst &lt;- tapply(df$salary, df$name, matrix, nrow = 4, byrow = TRUE)
  </code></pre>
  
  <p>Now I want to write all these 7 matrices to 7 different text files, It is working only for a single matrix at a time. I tried to put in a for loop but is not working</p>
  
  <pre><code>for (i in 1:7)
  {
  write.table(lst[i], ".txt", col.names = FALSE, row.names = FALSE, sep = "\t", quote = FALSE)
  }
  </code></pre>
  
  <p>Can any one suggest for the modifications in the for loop?</p>