Re: [R] Iterative process for reading in text files

From: Simon Blomberg <Simon.Blomberg_at_anu.edu.au>
Date: Fri 29 Apr 2005 - 15:50:35 EST

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.

>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
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Visiting Fellow
School of Botany & Zoology
The Australian National University
Canberra ACT 0200
Australia

T: +61 2 6125 8057  email: Simon.Blomberg@anu.edu.au
F: +61 2 6125 5573

CRICOS Provider # 00120C

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Apr 29 15:55:52 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:30 EST