对全部列重命名:
>data
SYMBOL ENTREZID
1 Retnla 57262
2 Klra1 16631
3 Klra8 16639
4 Plet1 76509
name(data) <- c("genename","geneentrezid")
对某一列重命名:
#01.plyr::rename
rename(data, genename= SYMBOL , geneentrezid= ENTREZID)
#02.dplyr::rename
plyr::rename(d, c("SYMBOL"="genename", "ENTREZID "="geneentrezid"))
#03
colnames(data)[2] <- 'geneentrezid'
colnames(data)[colnames(data)=="genename"] <- "SYMBOL"
常用:
colnames(data)[colnames(data)=="genename"] <- "SYMBOL"