Wednesday, 7 August 2013

Using R, how to find the line number of a specific phrase in a file without opening the file?

Using R, how to find the line number of a specific phrase in a file
without opening the file?

I am new to R. I have a large (3.2 Gb) txt file containing two columns.
First column has the human genome sequence position and the Second column
has a value corresponding to each position. I want to find the line
numbers for specific positions from the first column and then read those
lines into a table in R. I cannot import the file because of memory issue.
here is an example of the R code I tried to get the line number of one
specific position from the first column of my data file. the data file is
called my.data.
con <- file("my.data",open="r");
grep("13108", con)
grep does not work.
I will appreciate if someone can tell me the correct code.

No comments:

Post a Comment