[R] Separator with " | " for read.table

From: Gundala Viswanath <gundalav_at_gmail.com>
Date: Mon, 16 Jun 2008 10:11:53 +0900


Hi,

I have the following data file to be parsed and captured as a data frame:

__DATA__

#GDS_ID GENE_NAME GENE_DESCRIPTION GENE_FUNCTION
1007_s_at | DDR1 | discoidin domain receptor tyrosine kinase 1 | protein-coding
1053_at | RFC2 | replication factor C (activator 1) 2, 40kDa | protein-coding
117_at | HSPA6 | heat shock 70kDa protein 6 (HSP70B') | protein-coding

__END__
In particular it is separated by " | " , namely - space, bar, space. However I tried this without avail:

geneinfo <- read.table("mydata.txt", sep=" | ", comment.char="\#") print(geneinfo)

I also tried with sep= "|", it gave a wrong parsing. Please advice.


R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 16 Jun 2008 - 01:16:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 16 Jun 2008 - 02:30:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive