From ac5eaec24edc0576c2ff749b33df61c4587f4fdf Mon Sep 17 00:00:00 2001 From: Costa <47926492N@ICO.SCS.local> Date: Fri, 4 Feb 2022 11:22:28 +0100 Subject: [PATCH] Corregir error al pasar un tibble a ggheatmap. --- R/ggheatmap.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/ggheatmap.R b/R/ggheatmap.R index 11cd698..55af49c 100644 --- a/R/ggheatmap.R +++ b/R/ggheatmap.R @@ -1,4 +1,5 @@ ggheatmap<-function(df, x=NULL, y=NULL, value=NULL){ + if (is.null(x)){x=colnames(df)[1]} if (is.null(y)){y=colnames(df)[2]} if (is.null(value)){value=colnames(df)[3]} @@ -6,7 +7,7 @@ ggheatmap<-function(df, x=NULL, y=NULL, value=NULL){ order<-clustsort(df %>% spread(y,value)) df %>% - ggplot(aes(df[,x], df[,y], fill=df[,value]))+ + ggplot(aes_string(x, y, fill=value))+ scale_x_discrete(limits=order$x)+ scale_y_discrete(limits=order$y)+ labs(x=x, y=y)+