Browse Source

Arreglar problema con el pvalue numérico.

main
Costa 2 years ago
parent
commit
05ac7461b6
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      R/ggcorrplot.R

+ 4
- 2
R/ggcorrplot.R

@ -8,8 +8,10 @@ ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif"){
df.pval<-mpval %>% as.data.frame() %>% add_column(Var1=rownames(mpval),.before=1) %>% df.pval<-mpval %>% as.data.frame() %>% add_column(Var1=rownames(mpval),.before=1) %>%
gather(Var2, Value, -Var1) gather(Var2, Value, -Var1)
df.pval$Value<-round(df.pval$Value, 3)
if (stat=="signif"){ if (stat=="signif"){
df.pval$Value<-gtools::stars.pval(as.numeric(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 order<- mcor %>% as.data.frame() %>% add_column(Var1=rownames(mcor),.before=1) %>% clustsort
@ -18,5 +20,5 @@ ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif"){
scale_x_discrete(limits=order$x)+ scale_x_discrete(limits=order$x)+
scale_y_discrete(limits=order$y)+ scale_y_discrete(limits=order$y)+
theme_heatmap(line.color=color)+ theme_heatmap(line.color=color)+
geom_text(data=df.pval, aes(label=round(Value, 2)))
geom_text(data=df.pval, aes(label=Value))
} }

Loading…
Cancel
Save