in R I have in mydata data frame which column names is gene id and row names are sample id:
ENSG00000000003 ENSG00000000004 ENSG00000000005
TCGA-QQ-A5VB 0.1 0.2 0.3
TCGA-DX-A8BO 0.3 0.1 0.2
TCGA-MO-A47R 0.3 0.1 0.2
Now I want to have a sample_ID column that valus are rownames(mydata) and add a column x before sample_ID column. also I want to insert rownames just by numbering same as below:
x Sample_ID ENSG00000000003 ENSG00000000004 ENSG00000000005
1 1 TCGA-QQ-A5VB 0.1 0.2 0.3
2 2 TCGA-DX-A8BO 0.3 0.1 0.2
3 3 TCGA-MO-A47R 0.3 0.1 0.2
I have to say mydata file has 56000 genes as colnames and the position of columns x and sample_ID are important. I don't want to have these columns in the end of columns.
I appreciate if anybody share his/her comment as code with me.
Best Regards,
Mohammad