[Rd] readLines needs some extra bit of documentation.

Hin-Tak Leung hin-tak.leung at cimr.cam.ac.uk
Mon May 21 18:00:30 CEST 2007


I have a need to use readLines to read just the first line
of a file and do some processing on that, and read and re-read
?readLines and did not see any mention of whether the actual
end-of-line character (LF, CR/LF or CR) is included as part of
the returned character vector or not.

I just tried it and and it seems that it strips the EOL characters
- so it is obvious as soon as one tries it, but I was hoping that it 
should be mentioned ?readLines (e.g. "The actual EOL character(s) are 
striped and not included as part of the returned character vector").

The reason why I was specifically looking for that information is that,
in perl, the line-input operator, <file> , returns character vectors
with the EOL included, and is opposite to that of R. I know I cannot
compare apple with orange, and R's readLines() behavior is obvious
as soon as one tries it, but an explicit sentence in the help page
would be nice...

HTL



More information about the R-devel mailing list