I have a big data frame dim(df)= 29 20664. It contains mutation and copy number variation data for genes. The column names are actually gene names. The column names currently are gene1, gene2 .... gene20664.
How can I change the column names from 1 to 19862 as gene1_mut, gene2_mut ... gene19862_mut
and from 19863 to 20664 as gene19863_CNV, gene19864_CNV..... gene20664_CNV.
I was trying following
names(geneMC)[19863:20664]<-paste("cnv_",19863:ncol(geneMC),sep="")
names(geneMC)[19863:20664]<-sprintf("cnv_%d",19863:ncol(geneMC),sep="")