[R] scan() Bug?
Greg Riddick
gr3k at virginia.edu
Thu Jan 22 23:24:53 CET 2004
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.
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?
>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
>
> Try opening the file as a connection using the 'read binary' mode. If you
> are running on a Windows system, the operating system is taking \10\13 and
> mapping that to just '\n' since that is the normal sequence that Windows
> uses on text files.
> __________________________________________________________
> James Holtman "What is the problem you are trying to solve?"
> Executive Consultant -- Office of Technology, Convergys
> james.holtman at convergys.com
> +1 (513) 723-2929
>
>
>
> "Greg Riddick"
> <gr3k at virginia.edu> To:
<r-help at stat.math.ethz.ch>
> >
>
>
> I'm reading a file into a list by:
> PDF = scan("file",what="character",sep="\10")
>
> "\10" is the newline character in this file, also tried "\n" originally
>
> On lines that are ended by "\13\10", both are dropped from the list entry
> I want scan to keep the "\13" in the list entry.
>
> Is this a bug or just a strange feature?
>
More information about the R-help
mailing list