Re: [R] Add header line to large text file

2010-04-15 Thread Zev Ross
Thanks to Wensui Liu and Jim Holtman for responses. Using sed was a good, quick (non-R) suggestion. Thanks! Zev Wensui Liu wrote: if i were you, i probably will use 1 line of sed to do such task instead of R to insert headers in the file. On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross [1] w

Re: [R] Add header line to large text file

2010-04-15 Thread Wensui Liu
if i were you, i probably will use 1 line of sed to do such task instead of R to insert headers in the file. On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross wrote: > All, > > I have a 30 million record text file without header information. I would > like to add a header to this file without reading it

Re: [R] Add header line to large text file

2010-04-15 Thread jim holtman
You also might take a look at using file.append to speed up the process. On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross wrote: > All, > > I have a 30 million record text file without header information. I would > like to add a header to this file without reading it first. Is this > possible? The cod

Re: [R] Add header line to large text file

2010-04-15 Thread jim holtman
If you want to place the header at the beginning of the file, then you have to read/write the entire file to get that first line in. On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross wrote: > All, > > I have a 30 million record text file without header information. I would > like to add a header to thi

[R] Add header line to large text file

2010-04-15 Thread Zev Ross
All, I have a 30 million record text file without header information. I would like to add a header to this file without reading it first. Is this possible? The code below does what I want except that the readLines portion takes quite a long time. Is there a way around reading the lines? I'm w