[R] Pipe delimiter ( | ) in "read.delim"

Zev Ross zev at zevross.com
Wed Apr 12 23:43:07 CEST 2006


Hi R folks,

Can anyone tell me how to read in a pipe ("|") delimited text file? I've 
tried the following:

read.delim("c:/junk/junk.txt",sep="|", skip=7, check.names=FALSE,quote = "",
    header=F)

The file looks something like the following:

RD|I|04|013|9997|68103|5|7|017|830|20000221|00:00|12.6||6|||||||||||||
RD|I|04|013|9997|68103|5|7|017|830|20000227|00:00|4.1||6|||||||||||||
RD|I|04|013|9997|68103|5|7|017|830|20000304|00:00|8.7||6|||||||||||||
RD|I|04|013|9997|68103|5|7|017|830|20000310|00:00|9.3||6|||||||||||||
RC|I|04|013|9997|68103|5|7|017|830|20000316|00:00|17.0||6|||||||||||||

While I'm at it, the S-PLUS import GUI has a FilterExpression that will 
limit what it imports. So if I wanted to limit the data above to those 
records beginning with an "RD" the filter expression would be "Col1= 
=\"RD\" ". Is there something similar to this in R?

Thank you, Zev

-- 
Zev Ross
*ZevRoss Spatial Analysis*
303 Fairmount Ave
Ithaca, NY 14850
(607) 277-0004 (phone)
(866) 877-3690 (fax toll-free)
zev at zevross.com
www.zevross.com




More information about the R-help mailing list