This is a test version of Biostars. For the public version, visit https://www.biostars.org.
duplicate 'row.names' are not allowed

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

2 answers

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

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 ]

Right, so put that through which().

thank you

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

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

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.

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

Log in to answer this question.