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

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 21 15:16:22 CET 2008


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


More information about the R-devel mailing list