I have a dataframe named 'res', where the row names are numbers corresponding to genes.
>res
baseMean log2FoldChange lfcSE stat pvalue padj
<numeric> <numeric> <numeric> <numeric> <numeric> <numeric>
27395 1268.40 0.100013 0.164840 0.606731 5.44029e-01 0.737925231
18777 1413.56 -0.266365 0.175847 -1.514758 1.29834e-01 0.312449929
21399 3376.09 -0.243707 0.132616 -1.837687 6.61086e-02 0.196027163
I am wondering how to give the row names of my dataframe the heading 'gene_id' so that my data frame ends up looking like this.
>res
gene_id baseMean log2FoldChange lfcSE stat pvalue padj
<numeric> <numeric> <numeric> <numeric> <numeric> <numeric>
27395 1268.40 0.100013 0.164840 0.606731 5.44029e-01 0.737925231
18777 1413.56 -0.266365 0.175847 -1.514758 1.29834e-01 0.312449929
21399 3376.09 -0.243707 0.132616 -1.837687 6.61086e-02 0.196027163
I am planning to bind this dataframe with another dataframe (anno) containing information of the actual genes, by the 'gene_id' column using the left_join function.
>anno
gene_id SYMBOL GENENAME
1 27395 Mrpl15 mitochondrial ribosomal protein L15
2 18777 Lypla1 lysophospholipase 1
3 21399 Tcea1 transcription elongation factor A (SII) 1
res_anno <- left_join(res, anno,by="gene_id")