Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades committed Sep 6, 2023
1 parent c7c980e commit 4ba5455
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions R/compare_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ compare_vars <- function(lyt,
.formats = NULL,
.labels = NULL,
.indent_mods = NULL) {
.stats <- .stats[!grepl("pval", .stats)] # tmp fix xxx
extra_args <- list(.stats = .stats, na.rm = na.rm, na_level = na_level, compare = TRUE, ...)
if (!is.null(.formats)) extra_args[[".formats"]] <- .formats
if (!is.null(.labels)) extra_args[[".labels"]] <- .labels
Expand Down
14 changes: 7 additions & 7 deletions R/utils_defaults_handling.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,24 @@ get_stats <- function(method_groups, type = NULL, stats_in = NULL, add_pval = FA
add_pval <- TRUE
}

# Filtering for stats_in (character vector)
if (!is.null(stats_in)) {
out <- intersect(stats_in, out) # It orders them too
}

# Mainly used in "analyze_vars" but it could be necessary elsewhere
if (isTRUE(add_pval)) {
if (length(type) > 1) {
stop("Only one type is allowed when add_pval = TRUE.")
}

if (!is.null(type) && "counts" %in% type) {
out <- unique(c(out, "pval_counts"))
out <- unique(c(out, "pval_counts"))
} else {
out <- unique(c(out, "pval"))
out <- unique(c(out, "pval"))
}
}

# Filtering for stats_in (character vector)
if (!is.null(stats_in)) {
out <- intersect(stats_in, out) # It orders them too
}

# If intersect did not find matches (and no pval?) -> error
if (length(out) == 0) {
stop(
Expand Down

0 comments on commit 4ba5455

Please sign in to comment.