Skip to content

Iterative process for reading in text files

1 message · Simon Blomberg

#
Do you mean that you have one file where the data is ordered by 
group? If so, using scan and a loop is an easy option. If you have 
the data in separate files by group, just make a character vector 
with your filenames as elements and use a loop to read the data using 
read.table at each iteration. Or if they all have similar names such 
as group1.txt, group2.txt, etc. you could construct the filenames on 
the fly using paste.

HTH,

Simon.