[R] read.csv, header=TRUE but skip the first line
Mark Knecht
markknecht at gmail.com
Sun Jun 28 23:05:59 CEST 2009
Hi,
Complete newbie to R here. Just getting started reading manuals and
playing with data.
I've managed to successfully get my *.csv files into R, however I
have to use header=FALSE because the real header starts in line #2.
The file format looks like:
PORTFOLIO EQUITY TABLE
TRADE,MARK-SYS,DATE/TIME,PL/SIZE,PS METHOD,POS SIZE,POS
PL,DRAWDOWN,DRAWDOWN(%),EQUITY
1,1,1/8/2004 12:57:00 PM,124.00,As Given,1,124.00,0.00,0,"10,124.00"
2,1,1/14/2004 9:03:00 AM,-86.00,As Given,1,-86.00,86.00,0.849,"10,038.00"
3,1,1/14/2004 11:51:00 AM,-226.00,As Given,1,-226.00,312.00,3.082,"9,812.00"
4,1,1/15/2004 12:57:00 PM,134.00,As Given,1,134.00,178.00,1.758,"9,946.00"
where the words "PORTFOLIO EQUITY TABLE" make up line 1, the rest of
the text is on line 2, and then the lines starting with numbers are
the real data. (Spaces added by me for email clarity only.)
If I remove the first line by hand then I can use header=TRUE and
things work correctly, but it's not practical for me to remove the
first line by hand on all these files every day.
I'd like to understand how I can do the read.csv but skip the first
line. Possibly read the file, delete the first line and then send it
to read.csv, or some other way?
Thanks in advance,
Mark
More information about the R-help
mailing list