[R] removing lines from text file

arun smartpink111 at yahoo.com
Thu Aug 23 14:48:38 CEST 2012



HI,
Try this:
dat1<-read.table(text="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",sep=",",skip=6,fill=TRUE,header=TRUE)

dat1
#         Date Open   High   Low Settle Volume OpenInt  X
#1 08-Jun-2009    0 469.50 469.5 469.50      0       0 NA
#2 09-Jun-2009    0 476.75 469.5 476.75      0       0 NA
A.K.



----- Original Message -----
From: Doug Edmunds <dougedmunds at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Thursday, August 23, 2012 1:22 AM
Subject: [R] removing lines from text file

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, ...)?

______________________________________________
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.





More information about the R-help mailing list