[R] reading in data contingent upon a character at col 1

Patrick E. McKnight pem at theriver.com
Tue Nov 13 22:32:03 CET 2001


Greetings,

I have a text file that is output from a statistics package that I would like 
to read into R.  Since I have several hundred of these output files I would 
prefer not to edit them manually.  The problem is that it has a ";" (without 
the quotes) as the first character for some lines - lines that I do not 
necessarily want to read in.  Use of tr, sed, awk or any other unix command 
line utilities would not be suitable for this application.   

A sample of the file looks like this:

; Title of the run
; some other information
; subject var1 var2 var3 var4
   000001   23   34   12   23
;  000002   00   00   00   00
   000003   15   18   30   29
;  000004   00   00   00   00
   000005   00   12   34   56

Essentially the commented out lines with the ";" characters were not 
estimated in the analysis so I do not want them to be read into the data 
frame.  Is there a way to skip the line if it contains a ";" in column 1?  If 
so, how might I accomplish this feat?  Thanks in advance for your help.

-- 
Cheers,

Patrick


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list