liwc <- read.csv("liwc.csv", header = TRUE)
liwc$X <- NULL

liwc[2:65]<- data.frame(lapply(liwc[2:65], function(X) X/X[153718]))
liwc = liwc[-153718,]
liwc[,2:65]<-scale(liwc[,2:65])

COR <- cor(as.matrix(liwc[,-1]), as.matrix(liwc[,-1]))

index <- COR <= 0
COR[index] = abs(COR[index])


#cor <- as.data.frame(COR)

#write.xlsx(cor, file="cor_all.xlsx", sheetName="Sheet1")

#heatmap
require(lattice)
## Loading required package: lattice
rgb.palette <- colorRampPalette(c("yellow1","coral","coral2","red3","coral4"), space = "rgb")

levelplot(COR, main="LIWC category correlation", xlab="", ylab="", col.regions=rgb.palette(120), cuts=100, at=seq(0,1,0.01))