Question: Error in read.table(file = file, header = header, sep = sep, quote = quote, : duplicate 'row.names' are not allowed
0
gravatar for IOM
2.6 years ago by
IOM0
United Kingdom, Birmingham, NHS
IOM0 wrote:

Hi,

Thanks for reading. I have searched for the answer to this problem in many places, however I am not able of finding the right one and the error keeps popping up. I am trying to read a table that has samples (86) as columns and genes as rows(>37.000).

enter image description here

I have tried to read it from different formats as tab delimited file (.txt) and comma separated values (.CSV) and with different functions (read.table, read.csv, etc)I always get the same error:

Error in read.table(file = file, header = header, sep = sep, quote = quote, : duplicate 'row.names' are not allowed

Has anybody any idea of how fixing this dumb error? Thanks and merry christmas.

IOM

ADD COMMENTlink modified 2.6 years ago • written 2.6 years ago by IOM0

Thanks Devon WouterDeCoster, I will check the CSV for duplicated rows. Merry christmas

IOM

ADD REPLYlink written 2.6 years ago by IOM0

Hi, I used following lines (http://stackoverflow.com/questions/6986657/find-duplicated-rows-based-on-2-columns-in-data-frame-in-r?rq=1)

dup <- data.frame(as.numeric(duplicated(data$X))) #creates df with binary var for duplicated rows colnames(dup) <- c("dup") #renames column for simplicity df2 <- cbind(data, dup) #bind to original df df3 <- subset(df2, dup == 1) #subsets df using binary var for duplicated`

And got the error, a gene name changed to Mar-01 repeated twice. Thanks again for your help.

IOM

ADD REPLYlink modified 2.6 years ago • written 2.6 years ago by IOM0

That's the March1 gene converted by excel.

ADD REPLYlink written 2.6 years ago by WouterDeCoster40k
1
gravatar for Devon Ryan
2.6 years ago by
Devon Ryan91k
Freiburg, Germany
Devon Ryan91k wrote:

The error message is telling you all you need to know. There's at least one duplicate entry in the first column. Perhaps you want to use row.names=F or whatever that option is called.

ADD COMMENTlink written 2.6 years ago by Devon Ryan91k

OP can just leave the row.names out, R will assume no rownames and add numbering instead.

ADD REPLYlink written 2.6 years ago by WouterDeCoster40k
0
gravatar for apa@stowers
2.6 years ago by
apa@stowers430
Kansas City
apa@stowers430 wrote:

It is probably a problem with your header row.

If the first row in the file has fewer fields than the second row, read.delim() (and all other functions built on it) will automatically assign column 1 to be rownames.

ADD COMMENTlink modified 2.6 years ago • written 2.6 years ago by apa@stowers430
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 658 users visited in the last hour