Skip to content

duplicate row.names

1 message · John Smith

#
row.names=NULL seems to have fixed my problem.  strange that NULL uses row
numbers and not specifying uses row numbers, but NULL poses no problems and
the latter does.

Thanks to you and everyone else who responded.

John

-----Original Message-----
From: Simon Blomberg [mailto:Simon.Blomberg at anu.edu.au]
Sent: Wednesday, July 16, 2003 9:50 PM
To: John Smith; r-help at stat.math.ethz.ch
Subject: RE: [R] duplicate row.names 


I think you need to be a bit more specific for us to be able to help you. At
least provide a toy problem which replicates the error. Does this do what
you want?

dat1 <- data.frame (x=rnorm(100), y=rnorm(100)) #make up some data
dat2 <- data.frame (x=rnorm(100), y=rnorm(100))
write.table(dat1, file="test1.txt") #write data to files
write.table(dat2, file="test2.txt")
F<- NULL # Initialise
for (i in 1:2) F <- rbind(F, read.table(paste("test", i, ".txt", sep="")))
F <- data.frame(F, row.names=NULL) # clean up row names.

Hope this helps,

Simon.

Simon Blomberg, PhD
Depression & Anxiety Consumer Research Unit
Centre for Mental Health Research
Australian National University
http://www.anu.edu.au/cmhr/
Simon.Blomberg at anu.edu.au  +61 (2) 6125 3379