From 0281fa95c88631900a27b6d5434495a0b6bf1d46 Mon Sep 17 00:00:00 2001 From: Costa <47926492N@ICO.SCS.local> Date: Fri, 4 Feb 2022 15:35:47 +0100 Subject: [PATCH] =?UTF-8?q?Corrigiendo=20el=20orden=20de=20la=20triangulac?= =?UTF-8?q?i=C3=B3n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/ggcorrplot.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/ggcorrplot.R b/R/ggcorrplot.R index d26e5b4..27364fb 100644 --- a/R/ggcorrplot.R +++ b/R/ggcorrplot.R @@ -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. 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() if (tri == "lower"){ 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) } - order<- mcor %>% as.data.frame() %>% add_column(Var1=rownames(mcor),.before=1) %>% clustsort - df$Var1<-factor(df$Var1, levels=order$x) df$Var2<-factor(df$Var2, levels=order$y)