|
@ -6,10 +6,10 @@ ggheatmap<-function(df, x=NULL, y=NULL, value=NULL, grouping="mean"){ |
|
|
df<-rename(df, "VarX"=all_of(x), "VarY"=all_of(y), "Value"=all_of(value)) |
|
|
df<-rename(df, "VarX"=all_of(x), "VarY"=all_of(y), "Value"=all_of(value)) |
|
|
|
|
|
|
|
|
if (grouping == "mean"){ |
|
|
if (grouping == "mean"){ |
|
|
df<-df %>% group_by(VarX,VarY) %>% summarise(Value=mean(Value)) |
|
|
|
|
|
|
|
|
df<-df %>% group_by(VarX,VarY) %>% summarise(Value=mean(Value)) %>% ungroup |
|
|
} |
|
|
} |
|
|
if (grouping == "median"){ |
|
|
if (grouping == "median"){ |
|
|
df<-df %>% group_by(VarX,VarY) %>% summarise(Value=median(Value)) |
|
|
|
|
|
|
|
|
df<-df %>% group_by(VarX,VarY) %>% summarise(Value=median(Value)) %>% ungroup |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
order<-clustsort(df %>% spread(VarY,Value) %>% as.data.frame) |
|
|
order<-clustsort(df %>% spread(VarY,Value) %>% as.data.frame) |
|
|