From smyth at wehi.edu.au  Wed Jul 27 06:20:38 2005
From: smyth at wehi.edu.au (Gordon Smyth)
Date: Wed, 27 Jul 2005 14:20:38 +1000
Subject: [Rd] R 2.1.1: read.table processes C-style escapes  (PR#8037)
Message-ID: <6.2.1.2.1.20050727141319.021c8c40@imaphost.wehi.edu.au>


>To: r-bugs at biostat.ku.dk
>From: Gordon Smyth <smyth at wehi.edu.au>
>Subject: R 2.1.1: read.table processes C-style escapes
>Date: Wed, 27 Jul 2005 12:51:45 +1000
>
>In R 2.1.1, the default behaviour of scan() was changed to process all 
>C-style escapes, even when a delimiter was specified using the 'sep' 
>argument. A new argument 'allowEscapes' was introduced to turn this 
>processing off.
>
>Because read.table() calls scan(), read.table() inherits the new default 
>behaviour of scan() but without a way to turn it off. For example, reading 
>a file testdata.txt' containing
>
>X
>A
>\0
>C
>
>produces
>
> > read.delim("testdata.txt")
>[1] X
><0 rows> (or 0-length row.names)
>
>It seems that all the occurances of scan() within read.table() need to 
>have 'allowEscapes=FALSE' added to the argument string.

Or, alternatively and perhaps better, scan() could regain some of its 
earlier behaviour, to process C-style escapes by default only when 'sep' is 
NULL or empty. It seems, to me at least, that C-style escape sequences make 
sense only in some sort of source code, and delimited text can't be source 
code.

Gordon

>Gordon
>
> > version
>          _
>platform i386-pc-mingw32
>arch     i386
>os       mingw32
>system   i386, mingw32
>status   Patched
>major    2
>minor    1.1
>year     2005
>month    07
>day      22
>language R



[Rd] R 2.1.1: read.table processes C-style escapes (PR#8037)
Gordon Smyth