#----------相关系数图----------
#--------male------
mydata<-read.table('D:\\文件\\2023春 (大三下)\\2022~2023市调\\问卷分析\\random forest\\random forest_male_cor.csv',header=T,sep=',',stringsAsFactors = FALSE )
summary(mydata)
head(mydata)
res <- cor(mydata)
install.packages("corrplot") #下载相关系数矩阵corrplot包
library(corrplot)
corrplot(res, method = "shade",shade.col = NA, tl.col ="black", tl.srt = 45, addCoef.col="black",number.cex=0.7,order = "AOE") # 绘制相关系数矩阵图
#---------female----------
mydata2<-read.table('D:\\文件\\2023春 (大三下)\\2022~2023市调\\问卷分析\\random forest\\random forest_female_cor.csv',header=T,sep=',',stringsAsFactors = FALSE )
summary(mydata2)
head(mydata2)
res <- cor(mydata2)
install.packages("corrplot") #下载相关系数矩阵corrplot包
library(corrplot)
corrplot(res, method = "shade",shade.col = NA, tl.col ="black", tl.srt = 45, addCoef.col="black",number.cex=0.7,order = "AOE") # 绘制相关系数矩阵图