|
@ -3,6 +3,11 @@ ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif", tri="all"){ |
|
|
mcor<-cor(m.df, m.df, use="pairwise.complete.obs") # Por defecto usa el método de Pearson. |
|
|
mcor<-cor(m.df, m.df, use="pairwise.complete.obs") # Por defecto usa el método de Pearson. |
|
|
mpval<-Hmisc::rcorr(as.matrix(m.df))$P |
|
|
mpval<-Hmisc::rcorr(as.matrix(m.df))$P |
|
|
|
|
|
|
|
|
|
|
|
order<- mcor %>% as.data.frame() %>% add_column(Var1=rownames(mcor),.before=1) %>% clustsort |
|
|
|
|
|
|
|
|
|
|
|
mor<-mcor[order$y, order$x] |
|
|
|
|
|
mpval<-mpval[order$y, order$x] |
|
|
|
|
|
|
|
|
df<-mcor %>% as.data.frame() |
|
|
df<-mcor %>% as.data.frame() |
|
|
if (tri == "lower"){ |
|
|
if (tri == "lower"){ |
|
|
df[lower.tri(df, diag=T)]<-NA |
|
|
df[lower.tri(df, diag=T)]<-NA |
|
@ -23,8 +28,6 @@ ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif", tri="all"){ |
|
|
df.pval$Value<-gtools::stars.pval(df.pval$Value) |
|
|
df.pval$Value<-gtools::stars.pval(df.pval$Value) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
order<- mcor %>% as.data.frame() %>% add_column(Var1=rownames(mcor),.before=1) %>% clustsort |
|
|
|
|
|
|
|
|
|
|
|
df$Var1<-factor(df$Var1, levels=order$x) |
|
|
df$Var1<-factor(df$Var1, levels=order$x) |
|
|
df$Var2<-factor(df$Var2, levels=order$y) |
|
|
df$Var2<-factor(df$Var2, levels=order$y) |
|
|
|
|
|
|
|
|