added quick summary to see sig meds just before writing file

This commit is contained in:
Tanushree Tunstall 2020-11-20 12:36:55 +00:00
parent 17aebc26e8
commit 1562a09631
8 changed files with 63 additions and 29 deletions

View file

@ -71,8 +71,8 @@ foo = lf_t1[which(is.na(lf_t1$value)),]
lf_t1_comp = lf_t1[-which(is.na(lf_t1$value)),]
stats_un_t1 = compare_means(value~obesity
, group.by = "mediator"
, data = lf_t1
#, data = lf_t1_comp
#, data = lf_t1
, data = lf_t1_comp
, paired = FALSE
, p.adjust.method = my_adjust_method)
@ -368,9 +368,23 @@ colnames(combined_unpaired_stats_f) = c("mediator"
, "p_bon_signif")
colnames(combined_unpaired_stats_f)
#---------------
# quick summary
#---------------
# count how many meds are significant
n_sig = length(combined_unpaired_stats_f$mediator[combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)])
sig_meds = combined_unpaired_stats_f[(combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)),]
sig_meds$med_time = paste0(sig_meds$mediator, "@", sig_meds$timepoint)
cat("\nTotal no. of statistically significant mediators in", toupper(my_sample_type)
, "are:", n_sig
, "\nThese are:", sig_meds$med_time)
#######################################################################
#******************
# write output file
#******************
cat("UNpaired stats for groups will be:", flu_stats_time_unpaired)
write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)
cat("\nUNpaired stats for groups will be:", flu_stats_time_unpaired)
#write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)