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

smyth@wehi.edu.au smyth at wehi.edu.au
Wed Jul 27 04:52:15 CEST 2005


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.

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
---------------------------------------------------------------------------------------
Dr Gordon K Smyth, Senior Research Scientist, Bioinformatics,
Walter and Eliza Hall Institute of Medical Research,
1G Royal Parade, Parkville, Vic 3050, Australia
Tel: (03) 9345 2326, Fax (03) 9347 0852,
Email: smyth at wehi.edu.au, www: http://www.statsci.org



More information about the R-devel mailing list