Re: [R] Skipping specified rows in scan or read.table

2008-04-13 Thread Paul Smith
On Wed, Apr 9, 2008 at 7:37 PM, Ravi Varadhan [EMAIL PROTECTED] wrote: I have a data file, certain lines of which are character fields. I would like to skip these rows, and read the data file as a numeric data frame. I know that I can skip lines at the beginning with read.table and scan,

Re: [R] Skipping specified rows in scan or read.table

2008-04-10 Thread Abhijit Dasgupta
Hi Ravi, One thing I tend to do is, when using read.table, specify the option 'colClasses='character''. This forces everything to be read as a character. From there, as.numeric works fine, and you don't have to deal with factors and reconverting them. Hope this helps Abhijit Ravi Varadhan

[R] Skipping specified rows in scan or read.table

2008-04-09 Thread Ravi Varadhan
Hi, I have a data file, certain lines of which are character fields. I would like to skip these rows, and read the data file as a numeric data frame. I know that I can skip lines at the beginning with read.table and scan, but is there a way to skip a specified sequence of lines (e.g., 1, 2,

Re: [R] Skipping specified rows in scan or read.table

2008-04-09 Thread jim holtman
Read the file in as lines of text (readLines), 'grep' through the character vector and delete the lines you want and then use: read.table(textConntection(yourvector)) to read the corrected data in. On 4/9/08, Ravi Varadhan [EMAIL PROTECTED] wrote: Hi, I have a data file, certain lines of

Re: [R] Skipping specified rows in scan or read.table

2008-04-09 Thread Prof Brian Ripley
On Wed, 9 Apr 2008, Ravi Varadhan wrote: Hi, I have a data file, certain lines of which are character fields. I would like to skip these rows, and read the data file as a numeric data frame. I know that I can skip lines at the beginning with read.table and scan, but is there a way to