[R] duplicate row.names are not allowed

Gabor Grothendieck ggrothendieck at gmail.com
Fri Dec 7 07:33:21 CET 2007


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:
> 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-help at 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.
>



More information about the R-help mailing list