Try readLines, for instance:
# test.txt contents
comments
a,b,c
1,1,1
2,2,2
> readLines("c:/test.txt",1)
[1] "comments"
> read.csv("c:/test.txt",skip=1)
a b c
1 1 1 1
2 2 2 2
Coen
On Wed, Dec 2, 2009 at 19:26, Graham Smith <[email protected]> wrote:
> When a text file starts with a few lines commented out with # can you
> read those line from within R.
>
> read.table ignores the comments to load the file, but it would
> sometimes be useful to be able to read what these comments say.
>
> Thanks,
>
> Graham
>
> ______________________________________________
> [email protected] 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.
>
______________________________________________
[email protected] 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.