This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert my first column containing duplicate names to the row names

I have a gene expression dataset

> View (p53genes)

     Genesymbol     WT1        WT2          WT3        MUT1         MUT2
1   NAT2         2.707238   2.960215       3.554969  2.219525   3.812129
2   NAT2         7.861489   7.128331       7.190403  7.481062   8.034329
3   ADA          6.624238   4.828936       6.467866  6.430245   2.221382
4   CDH2         6.676011   6.015457       6.293267  6.649966   4.123641
5   CDH2         4.508974   6.093028       5.223152  4.579542   6.144728

when I do

>p53genes2 <- rownames(p53genes)

I am getting "1" "2" "3" "4" as my rownames

So I did

>rownames(p53genes) <- p53genes[,1]

Error: duplicate 'row.names' are not allowed

So how can I take my rownames as my genesymbols and not the numerics 1,2,3?

Thank you in advance for your responses.

r alignment software error rna-seq sequencing

You have duplicated gene names. How comes?

Obviously, in R duplicate 'row.names' are not allowed. How could R identify your rows when they have the identical row name?

1 answer

You can't make gene names row names, as they might not be unique, and in your data, they are not.

Far smarter to stick to refseq IDs or ensembl ids, which are unique.

Log in to answer this question.