saving different files using variable name

I've set a variable "i" to equal 1 and now want to use that value to save it into a file. For example, I want to write a new file with the following command:

"write.table(ev001, file=/pathdirectory/filename-run0[i]', row.names = F, col.names = F)"

where "i" will be replaced as "1". Is this possible? If so, how can I go about doing this?

Note: my ultimate plan is to build a for loop so that the value of "i" will increase. However, for now I'm just trying to teach myself how to set a variable and use it in different aspects of R code.

Thanks in advance for your help!

You have to construct the character string using paste()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.