From 4db08dc4f4d30f37b2ac0f6831e3ed0b5b1b5e74 Mon Sep 17 00:00:00 2001 From: Costa <47926492N@ICO.SCS.local> Date: Fri, 4 Feb 2022 14:54:47 +0100 Subject: [PATCH] =?UTF-8?q?A=C3=B1adiendo=20la=20opci=C3=B3n=20(por=20defe?= =?UTF-8?q?cto)=20de=20mostrar=20pvalue=20como=20estrellas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/ggcorrplot.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/ggcorrplot.R b/R/ggcorrplot.R index b63666e..a1642eb 100644 --- a/R/ggcorrplot.R +++ b/R/ggcorrplot.R @@ -1,4 +1,4 @@ -ggcorrplot<-function(df, var, color="#FFFFFF00"){ +ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif"){ m.df<-df %>% spread(Cyt, Value) %>% select(-pats) 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 @@ -8,6 +8,10 @@ ggcorrplot<-function(df, var, color="#FFFFFF00"){ df.pval<-mpval %>% as.data.frame() %>% add_column(Var1=rownames(mpval),.before=1) %>% gather(Var2, Value, -Var1) + if (stat=="signif"){ + df.pval$Value<-gtools::stars.pval(df.pval$Value) + } + order<- mcor %>% as.data.frame() %>% add_column(Var1=rownames(mcor),.before=1) %>% clustsort ggplot(df, aes(Var1, Var2, fill=Value))+