[R] how do I name data frames and files according to the index of a for loop?

Dieter Menne dieter.menne at menne-biomed.de
Thu Oct 8 08:24:57 CEST 2009




Ken Ervin wrote:
> 
> 
> for (i in 1:2858) {
> ...
>         write.table(Data_frame_name,file="~/file/goes/here.csv", append 
> = FALSE, sep = "\t",row.names = FALSE, col.names = c("Calc_1", "Calc_2", 
> "Calc_3"),qmethod = "double")
>    
> }
> 
> 
> 

use something like

filename = paste("~/file/myfile",i,".csv",sep="") 

then 

... file = filename.

Dieter
-- 
View this message in context: http://www.nabble.com/how-do-I-name-data-frames-and-files-according-to-the-index-of-a-for-loop--tp25798724p25799032.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list