[R] duplicate row.names are not allowed

0 views
Skip to first unread message

step...@ics.mq.edu.au

unread,
Dec 7, 2007, 1:24:05 AM12/7/07
to r-h...@stat.math.ethz.ch
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

______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Gabor Grothendieck

unread,
Dec 7, 2007, 1:33:21 AM12/7/07
to step...@ics.mq.edu.au, r-h...@stat.math.ethz.ch
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.

Petr PIKAL

unread,
Dec 7, 2007, 2:23:37 AM12/7/07
to step...@ics.mq.edu.au, r-h...@stat.math.ethz.ch
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-...@r-project.org napsal dne 07.12.2007 07:24:05:

Reply all
Reply to author
Forward
0 new messages