小编Gre*_*001的帖子

Pheatmap:annotation_colors[[colnames(annotation)[i]]]中的错误:下标超出范围

library(pheatmap)

another<-read.table("~/Desktop/tcga3dcategorized.csv",sep=',',header=FALSE)
test<-another[1:3]
labels<-another[4]
colnames(test)=c("Dim 1","Dim 2","Dim 3")

annotation_row=data.frame(CancerType=factor(labels))
ann_colors=list(CancerType=c(KIRC="red", UCEC="#B2509E",LUSC="#D49DC7",
    LGG="#C1A72F",PCPG="#E8C51D",HNSC="#F9ED32",CESC="#104A7F",ESCA="#9EDDF9",
    BRCA="#007EB5",THCA="#CACCDB",PRAD="#6E7BA2",MESO="#DAF1FC",PAAD="#00AEEF",
    LUAD="#F6B667",LAML="#D97D25",UVM="#FBE3C7",GBM="#F89420",READ="#97D1A9",
    SKCM="#009444",KIRP="#754C29",COAD="#CEAC8F",LIHC="#3953A4",SARC="#BBD642",
    OV="#00A99D",BLCA="#D3C3E0",STAD="#A084BD",TGCT="#542C88",ACC="#FAD2D9",
    THYM="#ED1C24",KICH="#F8AFB3",DLBC="#EA7075",UCS="#7E1918",CHOL="#BE1E2D"))

pheatmap(test,annotation_row=annotation_row,annotation_colors=ann_colors,main="title")
```
Run Code Online (Sandbox Code Playgroud)

错误是:

Error in annotation_colors[[colnames(annotation)[i]]] : 
  subscript out of bounds
Run Code Online (Sandbox Code Playgroud)

r bioinformatics pheatmap

4
推荐指数
1
解决办法
8395
查看次数

标签 统计

bioinformatics ×1

pheatmap ×1

r ×1