Guest User

Untitled

a guest
Dec 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. library(corrplot)
  2. gendat = read.csv("NEW_RBP/TF_MYELOID_DISEASE.txt",row.names = 1,sep = "t")
  3.  
  4. dim(gendat)
  5. head(gendat)
  6. gen <- gendat
  7. head(gen)
  8. M<- cor(gen, use="complete.obs", method="spearman")
  9. corr <- round(cor(M),1)
  10.  
  11.  
  12.  
  13.  
  14. names(gen)
  15. dim(gen)
  16.  
  17. mycolors <- rep(NA,23)
  18. names(mycolors) <- names(gen)
  19. mycolors[1:4] <- 'black' # mpg, cyl, disp, hp
  20. mycolors[5:15] <- 'red' # drat, wt, qsec, vs, am
  21. mycolors[16:23] <- 'blue'
  22. mycolors[13:16] <- 'darkgreen'
  23.  
  24.  
  25.  
  26. ord <- corrMatOrder(corr, order="hclust")
  27. newcolours <- mycolors[ord]
  28. newcolours
  29. corrplot(M, tl.col = newcolours, method = "color",is.corr = FALSE,
  30. tl.srt = 45,diag = TRUE
  31. ,order = "hclust",hclust.method = c("complete"),addrect = 5,tl.cex = 3,number.cex=1.5)
  32.  
  33. corrplot(corr, tl.col = newcolours, method = "color",is.corr = TRUE,
  34. tl.srt = 45,diag = TRUE
  35. ,order = "hclust",hclust.method = c("complete"),addrect = 3,tl.cex = 3,number.cex=1.5)
Add Comment
Please, Sign In to add comment