[Rd] Request: scan() argument 'allowEscapes' in read.table() too, please.

Henrik Bengtsson hb at maths.lth.se
Tue May 24 22:18:25 CEST 2005


I would like to suggest adding argument 'allowEscapes' to 
read.table(..., allowEscapes=TRUE) and pass it to its three calls to 
scan(..., allowEscapes=allowEscapes).

Rd (from ?scan):
\item{allowEscapes}{logical. Should C-style escapes such as '\n' be 
processed (the default) or read verbatim?   Note that if not within 
quotes these could be interpreted as a delimiter (but not as a comment 
character).}

Currently, it is not possible to use read.table() to read tab-delimited 
files with elements containing the string "\t" (not a TAB), i.e. the two 
characters "\" and "t". Example:

<file>
A	B
1	a\tb
2	c\td
</file>

<readable>
A<tab>B
1<tab>a\tb
2<tab>c\td
</readable>

Try to read the above with

scan(stdin(), what=character(0), sep="\t", allowEscapes=FALSE)

and this

scan(stdin(), what=character(0), sep="\t", allowEscapes=TRUE)

Cheers

Henrik Bengtsson



More information about the R-devel mailing list