#[1]
ifname<- "DataBloodType.csv"
alldata <- read.delim(ifname, header=T, sep=",", as.is=TRUE, strip.white=FALSE)
BloodMatrix<-as.matrix(alldata[,-c(1,2,3)])
rownames(BloodMatrix)<-alldata[[1]]
cor(BloodMatrix)
#[2]
#---plot for the upper light triangular matrix
upper <- function(x, y, ...){ 
  oldpar <- par(usr = c(0, 1, 0 ,1),fg = c("red"))
  v <- abs(cor(x, y)); w <- cor(x, y)
  sz <- 0.5 + v*2 # size of text depending on correlation
  text(0.5, 0.5, sprintf("%.3f", w), cex = sz)
  par(oldpar)
}
#---plot for the lower left triangular matrix
lower <- function(x, y, ...){ # 
    points(x, y, pch = 21, bg=c("blue"),lex=1.0)
  if( abs(cor(x, y)) > 0.8 ){ # threshold of line
    lmobj <- lm(y~x)
    abline(lmobj)
  }
}
#[3] all pairs of plots -------------------------------
#pairs(BloodMatrix, upper.panel=upper, lower.panel=lower)
#[4]
if(!require(PerformanceAnalytics)){
  install.packages("PerformanceAnalytics"); library(PerformanceAnalytics) 
}
chart.Correlation(BloodMatrix)