Browse Source

Hacer que no ordene si una de las dimensiones no tiene más de un elemento para que no de error en el hclust.

main
Costa 2 years ago
parent
commit
bd98a08c31
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      R/ggheatmap.R

+ 7
- 1
R/ggheatmap.R

@ -16,7 +16,13 @@ ggheatmap<-function(df, x=NULL, y=NULL, value=NULL, grouping="mean", exclude_gro
if (grouping == "median"){
df<-df %>% summarise(Value=median(Value)) %>% ungroup
}
order<-clustsort(df %>% spread(VarY,Value) %>% select(!all_of(exclude_group)) %>% as.data.frame)
if (length(unique(df$VarX)) > 1 & length(unique(df$VarY)) > 1){
order<-clustsort(df %>% spread(VarY,Value) %>% select(!all_of(exclude_group)) %>% as.data.frame)
}else{
order<-list("x"=df %>% pull(VarX) %>% unique, "y"=df %>% pull(VarY) %>% unique)
}
if (scale != "none"){
if (scale == "rows"){

Loading…
Cancel
Save