[R] removing lines from text file

Berend Hasselman bhh at xs4all.nl
Thu Aug 23 08:32:13 CEST 2012


On 23-08-2012, at 07:22, Doug Edmunds wrote:

> I downloaded a text file which has several lines of text before the header line of the data, similar to this:
> 
> ---start---
> "Corn December 2012 (CZ2012)"
> Source:  Wikiposit Open Data via wikiposit.org (http://wikiposit.org/uid?FUTURE.CZ2012)
> Update: http://wikiposit.org/w?action=dl&dltypes=comma%20separated&sp=daily&uid=FUTURE.CZ2012
> 
> Date,Open,High,Low,Settle,Volume,OpenInt,
> 08-Jun-2009,0,469.5,469.5,469.5,0,0,
> 09-Jun-2009,0,476.75,469.5,476.75,0,0,
> ...
> 
> After I download the file using R, how do I remove the lines of text
> that appear before the header line (Date, Open, ...)?
> 

?read.table

Use the argument skip of the read.XXX functions (XXX=table, csv,csv2 etc.)

Berend




More information about the R-help mailing list