From b05f520081a34df1120e5f5812dbf9e5f1b825d6 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Fri, 17 Sep 2021 13:33:19 +0100 Subject: [PATCH] fixed lf_bp function with aes_string and reformulate --- scripts/functions/lf_bp.R | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/functions/lf_bp.R b/scripts/functions/lf_bp.R index 608247d..71b0472 100644 --- a/scripts/functions/lf_bp.R +++ b/scripts/functions/lf_bp.R @@ -29,11 +29,17 @@ lf_bp <- function(lf_df , stat_method = "wilcox.test" , my_paired = FALSE , stat_label = c("p.format", "p.signif") ){ - - p1 <- ggplot(lf_df, aes(x = eval(parse(text = x_grp)) - , y = eval(parse(text = y_var)) )) + + + fwv = as.formula(paste0("~", facet_var)) + p1 <- ggplot(lf_df, aes_string(x = x_grp, y = y_var)) + - facet_wrap(~ eval(parse(text = facet_var)) + #fwv = eval(parse(text = facet_var)) + # facet_wrap(~ fwv + # , nrow = n_facet_row + # , scales = y_scales) + + # + # fwv = as.formula(paste0("~", facet_var)) + facet_wrap( fwv , nrow = n_facet_row , scales = y_scales) + @@ -73,7 +79,7 @@ lf_bp <- function(lf_df , cex = 0.8 , aes(colour = factor(eval(parse(text = colour_categ))) )) } - + # Add foramtting to graph OutPlot = p2 + theme(axis.text.x = element_text(size = my_ats) , axis.text.y = element_text(size = my_ats