Possible Duplicate:
writing many files in a for loop using R
I am trying to figure our how I can write data to many different files using a for loop:
for example:
for (i in 1:4)
{
x = i
write(x, file = "C:\\Documents and Settings\\user\\Desktop\\R_stuff\\testi.txt", append = FALSE, sep = ",")
}
I want to create 4 text files: test1 that contains 1; test2 that contains 2; test3 that contains 3; test 4 that contains 4.
However, I don't know the syntax that will allow the loop the change the name of the text file on each iteration. Obviously my "testi.txt" doesn't work :).
Thank You in advance.