Browse Source

Añadida opción para tri="upper.

main
Costa 2 years ago
parent
commit
5d9fec1c62
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      R/ggcorrplot.R

+ 8
- 2
R/ggcorrplot.R

@ -9,16 +9,22 @@ ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif", tri="all"){
mpval<-mpval[order$y, order$x]
df<-mcor %>% as.data.frame()
if (tri == "lower"){
if (tri == "upper"){
df[lower.tri(df, diag=F)]<-NA
}
if (tri == "lower"){
df[upper.tri(df, diag=F)]<-NA
}
df<-df %>% add_column(Var1=rownames(mcor),.before=1) %>%
gather(Var2, Value, -Var1) %>% filter(!is.na(Value))
df.pval<-mpval %>% as.data.frame()
if (tri == "lower"){
if (tri == "upper"){
df.pval[lower.tri(df.pval, diag=F)]<-NA
}
if (tri == "lower"){
df.pval[upper.tri(df.pval, diag=F)]<-NA
}
df.pval<-df.pval %>% add_column(Var1=rownames(mpval),.before=1) %>%
gather(Var2, Value, -Var1) %>% filter(!is.na(Value))

Loading…
Cancel
Save