Re: [R] Prevent read.table from converting "+" and "-" to 0

From: Prof Brian Ripley <>
Date: Tue, 04 Nov 2008 15:15:37 +0000 (GMT)

On Tue, 4 Nov 2008, Duncan Murdoch wrote:

> On 11/4/2008 9:08 AM, Daren Tan wrote:
>> I am using read.table("data.txt", sep="\t") to read in a tab-limited text
>> file. However, two columns of data were read wrongly. read.table converts
>> "+" and "-" in the two columns to 0. I have tried setting other parameters
>> but to no avail.

> Set the column classes (using the colClasses argument). It is guessing
> numeric, but clearly that's not true.

I don't think any recent version of R (e.g. 2.7.1 and later) does that, although some earlier versions did on some platforms.

So an even better solution is to update the R involved (as the posting guide asked...).

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 04 Nov 2008 - 15:19:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Nov 2008 - 15:30:21 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive