Thank you! This solved my problem
I have RNA-SEQ data i wanted to do DESeq (DEseq2 i am using). When i try to open my file it shows duplicate 'row.names' are not allowed like that. I already have gone through all kinds of possible ways which were discussed before but nothing worked.
This is my data
Tb927_01_v5.1 54039 54154 Novel 0 + 28 123 1 101 96 16 155 27 14 9 11
(I just highlighted every alternative tabs for your vision. I am not able to represent my data in a nice way sorry for that)
4 answers
The question is also duplicate
If you still want to use first column as rownames , use Check.name= FALSE
If it can help someone: I had the same error message:
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
duplicate 'row.names' are not allowed
when importing my file :
phenodata = "C:/Users/.../phenodata.txt"
read.delim(phenodata, row.name=1)
The .txt file was beforehand generated from Excel. I don't know why but there was a bug: you just have to copy-paste in excel your matrix to a new excel sheet, then to convert to a .txt file and re-try the import process. It should work ! Good luck,
R will not allow you to have rownames that are the same for each row. Using a rowname in the first place is unnecessary. There is, IMHO, a better convention for data handling in R.
Install the 'tidyverse', load the library, read the count data into a tibble. The R 'base' offers a lot, but so does 'tidyverse'. Beginners should at least be aware of and try it out, and also try to understand what 'tidy' data looks like, and why it might be a good idea.
install.packages('tidyverse')
library('tidyverse')
countdata <- read_tsv("file5.tsv")
Log in to answer this question.
What file is that? A count matrix? Please give some more details.
I am trying to find some new novel transcript from my sequencing file so i did multicov from bed tools to get the read counts. bedtools multicov -bams DS1.bam DS2.bam -bed transcript_I.bed > all_transcripts_I.tsv From that i took multicov output as a DESeq2 input file (all_transcripts_I.tsv).
R function i Uesd : countdata <- read.table("file5.tsv", header=TRUE, row.names=1)
The error i got : Error in read.table("file5.tsv", header = TRUE, row.names = 1) : duplicate 'row.names' are not allowed
My input file:
Because your rownames (First row) are same and you asked R to read the file by considering first row as rownames (row.names=1). Because of indexing issue R cannot take same name for multiple rows.
In your case it looks like your fourth column seems to be non-repetitive. You can consider using row.names=4
@OP: remove row.names=1.
Report the R function you used to read your file. Also provide exact error message.
R function i Uesd : countdata <- read.table("file5.tsv", header=TRUE, row.names=1)
The error i got : Error in read.table("file5.tsv", header = TRUE, row.names = 1) : duplicate 'row.names' are not allowed
Please provide reproducible example data, maybe paste output of
dput(head(MyData)). Also, post the command you are using that is causing the error.This must be one of the times when R error message are actually accurate and tell you what's wrong :')
You tell R to take column 1 as row names (
row.names=1)R tells you that there are duplicates in those row names