Skip to content

Iterative process for reading in text files

2 messages · Briggs, Meredith M, Manuel Morales

#
Hello

Instead of reading in group1.txt I want to read in groups1 for the first iteration of i, then groups2 for the second and so on. Obviously I can't use groups(i) but assume there is a way to do this.

group<-read.table("C:/Data/April 2005/group1.txt",header=T)

thanks in advance

Meredith
#
Hi Meredith,

When I've wanted to do this, I put all my files (group1.txt,
group2.txt ...) in a separate directory. Then, running R from that
directory:

files<-list(files)

for (i in 1:length(files)) {
group<-read.table(files[i],header=T)
do stats here
}
On Fri, 2005-04-29 at 15:17 +1000, Briggs, Meredith M wrote: