[Rd] readLines needs some extra bit of documentation.

From: Hin-Tak Leung <hin-tak.leung_at_cimr.cam.ac.uk>
Date: Mon, 21 May 2007 17:00:30 +0100

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


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 21 May 2007 - 16:53:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 May 2007 - 17:32:58 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.