From ripley at stats.ox.ac.uk  Mon Jan 21 15:16:22 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 21 Jan 2008 14:16:22 +0000 (GMT)
Subject: [Rd] read.table: wrong error message? (PR#10592)
In-Reply-To: <680ACB8C-635F-47EB-8A93-66491DFE6FDC@gmail.com>
References: <20080120165524.9D5E82834158@mail.pubhealth.ku.dk>
	<Pine.LNX.4.64.0801211126310.23058@auk.stats>
	<680ACB8C-635F-47EB-8A93-66491DFE6FDC@gmail.com>
Message-ID: <alpine.LFD.1.00.0801211413180.23146@gannet.stats.ox.ac.uk>

On Mon, 21 Jan 2008, David Reitter wrote:

> On 21 Jan 2008, at 11:38, Prof Brian Ripley wrote:
>> 
>> The first column of your file repeats 0 and 1, and your specification asked 
>> for the first column to be taken as the row names: from the help file
>>
>>    If 'row.names' is not specified and the header line has one less
>>    entry than the number of columns, the first column is taken to be
>>    the row names.
>
> I understand now. Thanks for the explanation.
>
> I would have figured it out myself had I paid attention to the fact that the 
> error message reports "row names" rather than "column names", or had the 
> error message actually contained the conflicting names (either "0" or "1") or 
> the full set of read names.

We can fairly easily do something along those lines: I've added code to 
R-devel to do

> library(MASS)
> row.names(hills)[35] <- "Lomonds"
Error in `row.names<-.data.frame`(`*tmp*`, value = c("Greenmantle", "Carnethy",  :
   duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique value when setting 'row.names': ?Lomonds?

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


[Rd] read.table: wrong error message? (PR#10592)
Prof Brian Ripley