Re: [R] merge tables in a loop

2011-01-26 Thread MacQueen, Don
Not sure exactly what you mean by, “ writing a table with several rows per file”. If what you want to do is write output to an external file, adding to it as your loop progresses, then look at the functions sink() cat() And their ‘file’ and ‘append’ arguments. If what you want to do is appe

[R] merge tables in a loop

2011-01-26 Thread clemens karwautz
I’m running a loop opening one file after another. >setwd("D:/Documents and Settings/trflp") >a<-list.files() >results.diversity<-data.frame(matrix(0,ncol=7,nrow=length(a))) >names(results.diversity)<-c("file","simpson","shannon","eveness") >x<-length(a) >for (i in 1:x){ > trflp<-read.table(a[i