[R] Adding header lines to a dataframe that is exported using write.csv

Sean Davis sdavis2 at mail.nih.gov
Mon Feb 27 12:32:20 CET 2006




On 2/27/06 6:03 AM, "Henrik Bengtsson" <hb at maths.lth.se> wrote:

> Just a tips: When you add headers to tabulate files like yours, it is
> convenient to start each header line with a '#' (like an R comment),
> because then read.table() will not complain about the header lines.
> It is easy to strip the '#' off the header lines, i.e. grep("^#", "",
> hlines) before further parsing.

You can also use the skip argument to read.table() to skip an arbitrary
number of lines of header information.

Sean




More information about the R-help mailing list