[R] scan() Bug?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 22 23:35:56 CET 2004

On Thu, 22 Jan 2004, Greg Riddick wrote:

> Thanks,
> Right, I can see why sep="\n" might grab the entire "\13\10"  but it seems
> like sep="\10" should not strip the "\13" also.

Why do you claim so?  Text mode is *documented* to use any of CR, CRLF or
LF as the line delimiter.  Please don't keep telling us R `should not' do 
things that are fully intentional and documented.

> I need to read in this file (PDF file) and create a list of lines defined by
> the "\10" delimiter.
> Any suggestions how I could use ReadBin to do that?

R is not really set up to deal with bytes in binary files (and a PDF file 
*is* a binary file).  You can however just read in the whole file and 
split it using strsplit, for example.

> >Not a strange feature, but the documented behaviour (and useful, too).
> >You have opened the file in text mode.  If you want to keep CRs, open and
> >read in binary mode.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list