Hi, I am trying to import a tab delimited file (converted from .xls file) by >Test<-read.table("/Users/....txt", header=T, row.names=1) The command has always worked for me, but now I have been getting the error message saying that "duplicate 'row.names' are not allowed. I have checked my original files and all names were unique. I have also tried to change the sample names (as 1, 2, 3,..., 13), it was still returning the same error message "duplicate 'row.names' are not allowed" to me. I have tried using "row.names=NULL", but it returned the column names as well. Does anyone know what the problem was? Thanks Fan Fan Yang Industrial Microbiology 2209 Biomedical Phys Sci Michigan State University Phone: (517)355-6463 Ext 1588 Email: yangfan1@msu.edu [[alternative HTML version deleted]]
I had the same problem one time. It was because I did a copy paste under excel that is to say i put some data from an other file at the following of the file, and R thought it was duplicate row.names. So i did two exports on R and after i did a rbind... I don't know if you did a copy paste like i did but the problem can be that. I did not find an other solution and i think other easier way are possible. Lo?c Fan Yang-4 wrote:> > Hi, > > I am trying to import a tab delimited file (converted from .xls file) by > >Test<-read.table("/Users/....txt", header=T, row.names=1) > > The command has always worked for me, but now I have been getting the > error message saying that "duplicate 'row.names' are not allowed. I > have checked my original files and all names were unique. I have > also tried to change the sample names (as 1, 2, 3,..., 13), it was > still returning the same error message "duplicate 'row.names' are not > allowed" to me. I have tried using "row.names=NULL", but it returned > the column names as well. > > Does anyone know what the problem was? Thanks > > Fan > > Fan Yang > Industrial Microbiology > 2209 Biomedical Phys Sci > Michigan State University > Phone: (517)355-6463 Ext 1588 > Email: yangfan1 at msu.edu > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/Data-import-error%3A-duplicate-%22row.names%22-tf4963044.html#a14215832 Sent from the R help mailing list archive at Nabble.com.
Read your file in without row names and check for duplicates: DF <- read.table(myfile, skip = 1, header = FALSE) myfile[duplicated(DF[[1]]), ] # list rows with duplicated column 1 On Dec 7, 2007 11:22 AM, Fan Yang <yangfan1 at msu.edu> wrote:> Hi, > > I am trying to import a tab delimited file (converted from .xls file) by > >Test<-read.table("/Users/....txt", header=T, row.names=1) > > The command has always worked for me, but now I have been getting the > error message saying that "duplicate 'row.names' are not allowed. I > have checked my original files and all names were unique. I have > also tried to change the sample names (as 1, 2, 3,..., 13), it was > still returning the same error message "duplicate 'row.names' are not > allowed" to me. I have tried using "row.names=NULL", but it returned > the column names as well. > > Does anyone know what the problem was? Thanks > > Fan > > Fan Yang > Industrial Microbiology > 2209 Biomedical Phys Sci > Michigan State University > Phone: (517)355-6463 Ext 1588 > Email: yangfan1 at msu.edu > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >