-
[R] 상관계수 , 피어슨수, 시각화 (pairs,corr.test)Study 2021. 7. 19. 17:20728x90반응형
cor(Pb)
coeff_Pb<-cor(Pb)
library(corrplot)
corrplot(coeff_Pb,method="number")
library(psych)
res=corr.test(Pb,use="complet",method="pearson",adjust="none")
P<-res$p
P
write.csv(P,file="c:/Users/p/Desktop/Pb_p.csv")
As<-read_excel("C:/Users/p/Desktop/total.xlsx",sheet="CV_As")
coeff_As<-cor(As)
res=corr.test(As,use="complet",method="pearson",adjust="none")
P<-res$p
write.csv(coeff_As,file="c:/Users/p/Desktop/As_CV.csv")
Cu<-read_excel("C:/Users/p/Desktop/total.xlsx",sheet="CV_Cu")
coeff_Cu<-cor(Cu)
res=corr.test(Cu,use="complet",method='pearson',adjust='none')
P<-res$p
write.csv(P,file="c:/Users/p/Desktop/Cu_p.csv")
Ni<-read_excel("C:/Users/p/Desktop/total.xlsx",sheet="CV_Ni")
coeff_Ni<-cor(Ni)
res=corr.test(Ni,use="complet",method='pearson',adjust='none')
P<-res$p
write.csv(P,file="c:/Users/p/Desktop/Ni_p.csv")
Zn<-read_excel("C:/Users/p/Desktop/total.xlsx",sheet="CV_Zn")
coeff_Zn<-cor(Zn)
res=corr.test(Zn,use="complet",method='pearson',adjust='none')
P<-res$p
write.csv(coeff_Zn,file="c:/Users/p/Desktop/Zn_CV.csv")
CV<-read_excel("C:/Users/p/Desktop/total.xlsx",sheet="CV")
coeff<-cor(CV)
coeff_cor<-fuction(x,y)[+r<-round(cor(x,y),3)+text<-paste0("Corr.=",r)+text(0.5,0.5,txt,cex=2)+]
pairs(coeff)
res=corr.test(Zn,use="complet",method='pearson',adjust='none')
P<-res$p
write.csv(coeff_Zn,file="c:/Users/p/Desktop/Zn_CV.csv")728x90'Study' 카테고리의 다른 글
추석공부계획 (09.19-09.22) (0) 2021.09.19 [R] 선그래프 그리기 (오차막대, % 표시, data 지우기 ) (0) 2021.08.05 [R] 누적막대그래프 그리기(ggplot2) (0) 2021.07.18 [R] 오차막대 선 그래프 그리기 (plyr,ddply,geom_errorbar) (0) 2021.07.16 통계공부 Youtube (0) 2021.07.16