Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f9101f2351 | |||
| f6b014b0b8 |
+9
-5
@@ -1,7 +1,7 @@
|
||||
ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif", tri="all"){
|
||||
ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif", tri="all", method="pearson"){
|
||||
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
|
||||
mcor<-cor(m.df, m.df, use="pairwise.complete.obs", method = method) # Por defecto usa el método de Pearson.
|
||||
mpval<-Hmisc::rcorr(as.matrix(m.df), type=method)$P
|
||||
|
||||
order<- mcor %>% as.data.frame() %>% add_column(Var1=rownames(mcor),.before=1) %>% clustsort
|
||||
|
||||
@@ -29,11 +29,15 @@ ggcorrplot<-function(df, var, color="#FFFFFF00", stat="signif", tri="all"){
|
||||
gather(Var2, Value, -Var1) %>% filter(!is.na(Value))
|
||||
|
||||
df.pval$Value<-round(df.pval$Value, 3)
|
||||
|
||||
if (!stat %in% c("signif","none","pval")){stat<-"signif"}
|
||||
if (stat=="signif"){
|
||||
df.pval$Value<-gtools::stars.pval(df.pval$Value)
|
||||
}
|
||||
|
||||
if (stat=="none"){
|
||||
df.pval$Value<-""
|
||||
}
|
||||
|
||||
|
||||
df$Var1<-factor(df$Var1, levels=order$x)
|
||||
df$Var2<-factor(df$Var2, levels=order$y)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user