Skip to content

duplicate row.names are not allowed

3 messages · stephenc at ics.mq.edu.au, Gabor Grothendieck, PIKAL Petr

#
I am using read.table and keep on getting this message.

The function is confusing my first column with a row.names column.  I have
checked the table carefully using excel and it seems quite symetric and
with a name at the top of each column.

This is what I am using:

form1 = read.table("c:/horses/form.tbl", sep="\t", header = T)

and this is the top few rows of the table:

fields.result	fields.age	fields.sex	fields.barrier	horse.winnings	
horse.form.ran	horse.form.win	horse.form.place	horse.form.at.this.track.ran	horse.form.at.this.track.win	horse.form.at.this.track.place	horse.form.at.this.distance.ran	horse.form.at.this.distance.win	horse.form.at.this.distance.place	horse.form.with.this.jockey.ran	horse.form.with.this.jockey.win	horse.form.with.this.jockey.place	horse.form.with.this.going.ran	horse.form.with.this.going.win	horse.form.with.this.going.place	rider.rides.last.3	rider.places.last.3	trainer.rides.last.3	trainer.places.last.3
4	4	G	3	50	5	0	0	0	0	0	0	0	0	0	0	0	1	0	0	0	0	36	0.166666667
2	5	G	5	3250	9	0	0.333333333	0	0	0	0	0	0	5	0	0.4	3	0	0.333333333	35	0.114285714	7	0.285714286
3	4	M	4	2075	11	0	0.090909091	0	0	0	0	0	0	0	0	0	1	0	0	0	0	13	0.307692308
5	5	M	2	0	2	0	0	0	0	0	0	0	0	1	0	0	1	0	0	54	0.185185185	2	0
1	4	M	7	1800	4	0	0.5	0	0	0	0	0	0	0	0	0	2	0	0	0	0	90	0.366666667

Can anyone suggest whats wrong or a workaround.

Thanks

Stephen
#
The message seems to be messed up but if your data has one more column
than the header then it will assume the first column is the row names.
Use the R count.fields function to diagnose this.
On Dec 7, 2007 1:24 AM, <stephenc at ics.mq.edu.au> wrote:
#
Hi

No error message? It seems to me that it is OK. There is of course limited 
width for printout on screen (see GUI preferences/console columns), and 
therefore everything which exceeds specified limits is printed on second 
and subsequent row.

try

dim(form1) or str(form1) for evaluation of your read data frame.

Regards
Petr

r-help-bounces at r-project.org napsal dne 07.12.2007 07:24:05:
have
horse.form.at.this.track.
horse.
horse.form.at.
horse.form.with.this.
horse.form.with.this.going.
trainer.places.last.3
0
0
0
0
http://www.R-project.org/posting-guide.html