
You could read the file and test each line (try readline()) but you need some rule to distinguish between text lines and data lines. You could then reread the file with the number of skip lines defined.

Ross Darnell 

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch on behalf of Tom Cohen
Sent: Fri 03-Aug-07 7:14 AM
To: r-help@stat.math.ethz.ch
Subject: [R] problem with reading data files with different numbers of lines	to skips
 
Dear  List, 
   
  I have 30 data files with different numbers of lines (31 and 33) that I want to skip before reading the files. If I use the skip option I can only choose either to skip 31 or 33 lines. The data files with 31 lines have no blank rows between the lines and the header row. How can I read the files without manually checking which files have 31 respectively 33 lines ?  The only text line I want to keep is the header.
   
  Thamks for your help,
  Tom
   
   
  for (i in 1:num.files) {
   a<-read.table(file=data[i],
  ,header=T,skip=31,sep='\t',na.strings="NA") 
  
  }
   
   
   

       
---------------------------------
Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling.

	[[alternative HTML version deleted]]



	[[alternative HTML version deleted]]

