Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0401222150200.20473-100000@gannet.stats>
Date: 2004-01-22T21:52:14Z
From: Brian Ripley
Subject: scan() Bug?
In-Reply-To: <000801c3e122$15c956c0$0400a8c0@ghandi>

On Thu, 22 Jan 2004, Greg Riddick wrote:

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

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