From 430f8246716c07b16ff6ef7ffce04ce25ef8ff0a Mon Sep 17 00:00:00 2001 From: Patrick Callahan Date: Mon, 18 Nov 2024 21:05:38 +0100 Subject: [PATCH] Fix distribution plotting bug --- R/utils.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index e14ac80..1ad7400 100644 --- a/R/utils.R +++ b/R/utils.R @@ -140,7 +140,7 @@ calculate_t1_error <- function(df, alpha = 0.05, t1_error_confidence_int = 95, n #' plot_distribution_results <- function(df, alpha = 0.05, outlier_removal = 0.10) { levels <- df %>% - pivot_longer(cols = all_of("sample_size"), names_to = "test_name") %>% + pivot_longer(cols = -all_of("sample_size"), names_to = "test_name") %>% group_by(.data[["test_name"]]) %>% summarize( mean = mean(.data[["value"]], na.rm = T) @@ -151,7 +151,7 @@ plot_distribution_results <- function(df, alpha = 0.05, outlier_removal = 0.10) df %>% pivot_longer(cols = -all_of("sample_size"), names_to = "test_name") %>% mutate(test_name = factor(.data$test_name, levels = levels)) %>% - group_by(-.data[["sample_size"]], .data$test_name) %>% + group_by(.data$sample_size, .data$test_name) %>% summarise(value = mean(.data$value)) %>% { ggplot(., aes(