-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring of analyze_vars
with specifics for .stat_names
#1361
base: main
Are you sure you want to change the base?
Conversation
all obs | ||
————————————————————— | ||
n 4 | ||
Mean (SD) 2.5 (1.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be NAs
n 5 | ||
a 2 (40%) | ||
b 1 (20%) | ||
NA 2 (40%) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lost NA
8 mean_ci (4.57, 5.69) 0 Mean 95% CI | ||
9 mean_sei (4.89, 5.38) 0 Mean -/+ 1xSE | ||
10 mean_sdi (4.35, 5.91) 0 Mean -/+ 1xSD | ||
2 sum 48.7 0 Sum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this calc changed?
.var, | ||
...) { | ||
checkmate::assert_flag(na.rm) | ||
s_summary <- function(x, denom, control, ...) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still to test correctly: denom and control handling
out <- levels_per_stats | ||
for (stat_i in seq_along(levels_per_stats)) { | ||
common_stat_names <- intersect(names(levels_per_stats), names(labels_in)) | ||
nm_of_levs <- levels_per_stats[[stat_i]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to comment better
#' | ||
#' @return A `list` with modified elements `x`, `.formats`, `.labels`, and `.indent_mods`. | ||
#' @return A `list` with modified elements `stat_out`, `.formats`, `.labels`, `.levels`, and `.indent_mods`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to fix: ungroup_stats should be removed in favor of get_*_from_stats
empty_pval <- "pval" %in% names(stat_out) && length(stat_out[["pval"]]) == 0 | ||
empty_pval_counts <- "pval_counts" %in% names(stat_out) && length(stat_out[["pval_counts"]]) == 0 | ||
stat_out <- unlist(stat_out, recursive = FALSE) | ||
|
||
# If p-value is empty it is removed by unlist and needs to be re-added | ||
if (empty_pval) x[["pval"]] <- character() | ||
if (empty_pval_counts) x[["pval_counts"]] <- character() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are if pval is NULL?
n 5 | ||
FALSE 1 (20%) | ||
TRUE 2 (40%) | ||
NA 2 (40%) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lost NA
Pull Request
Fixes #1352