duplicate 'row.names' are not allowed
2
0
Entering edit mode
7.2 years ago
zizigolu ★ 4.3k

hi,

I have an expression file, but when assigning row.names rownames(file)<- file[,1]

gives me Error in row.names<-.data.frame(*tmp*, value = value) : duplicate 'row.names' are not allowed

I tried this post

How To Deal With Duplicate Row Names Error In R

rownames(file) = make.names(nams, unique=TRUE)

Error in row.names<-.data.frame(*tmp*, value = value) : invalid 'row.names' length

how I can fix the problem please?

R • 10k views
ADD COMMENT
3
Entering edit mode
7.2 years ago

Find out which values are duplicates with the duplicated() function and then change them.

ADD COMMENT
0
Entering edit mode

thank you

saying

LSE FALSE

[9976] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

[9991] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

[ reached getOption("max.print") -- omitted 7644 entries ]

ADD REPLY
1
Entering edit mode

Right, so put that through which().

ADD REPLY
0
Entering edit mode

thank you

> which(duplicated(file))
integer(0)

via conditional formatting-duplicate values-remove duplicate values in excel I likely fixed the problem

ADD REPLY
1
Entering edit mode
7.2 years ago
ddiez ★ 2.0k

One question here is why are you having duplicated names? What does it mean? And, what to do with them? For example, if you are having duplicated gene names, so you have several rows containing information for the same gene, you may want to keep just one, and then Devon's solution is the way to go. Or, you may want to aggregate the results, computing, e.g. the mean value of the gene's expression in each sample. This will end also in unique names.

ADD COMMENT
1
Entering edit mode

Great! Now we can help F aggregate the mean of duplicate row names, to make a unique list.

ADD REPLY
2
Entering edit mode

This a common question, so please see here:https://support.bioconductor.org/p/90980/

ADD REPLY

Login before adding your answer.

Traffic: 1867 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6