From fa54503a5a65d3e5d56809e6951ea3ab03c78310 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Thu, 5 Sep 2024 20:19:29 -0400 Subject: [PATCH] Use a single N value --- workflow/apps/r/calculate_interaction_zscores5.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/apps/r/calculate_interaction_zscores5.R b/workflow/apps/r/calculate_interaction_zscores5.R index 4b35d257..718815af 100644 --- a/workflow/apps/r/calculate_interaction_zscores5.R +++ b/workflow/apps/r/calculate_interaction_zscores5.R @@ -196,7 +196,7 @@ calculate_summary_stats <- function(df, variables, group_vars = c("conc_num", "c # z_max = ~ifelse(sd(., na.rm = TRUE) == 0 | all(is.na(.)), NA, # (max(., na.rm = TRUE) - mean(., na.rm = TRUE)) / sd(., na.rm = TRUE)) # Z-score ), .names = "{.fn}_{.col}")) %>% - mutate(N = ~sum(!is.na(L))) # count of non-NA L values + mutate(N = sum(!is.na(L))) # count of non-NA L values # Join the summary stats back to the original dataframe df_with_stats <- left_join(df, summary_stats, by = group_vars)