Skip to content

Commit

Permalink
bug!: #130 meta_analyse_datasets() failing for ManyEcoEvo_results
Browse files Browse the repository at this point in the history
- Added conditional behaviour for when character vector supplied
- feat!: added arg checks #116 and cli output for when this condition is triggered

---

But wasn't failing for `yi` because `yi` received `rlang::expressions()` while `Zr` call used single length character variable for `outcome_variable` and `outcome_SE`
  • Loading branch information
egouldo committed Aug 29, 2024
1 parent 4d5b5f3 commit ff2e599
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion R/meta_analyse_datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,37 @@ meta_analyse_datasets <- function(data, outcome_variable = NULL, outcome_SE = NU
if (any(str_detect(unique(data$estimate_type), pattern = "Zr"))) {
outcome_variable <- "Zr"
outcome_SE <- "VZr"
cli::cli_bullets(
c("i" =
"Assigning default {.arg outcome_variable} = {.val {outcome_variable}}",
"i" =
"Assigning default {.arg outcome_SE} = {.val {outcome_SE}}")
)
} else {
outcome_variable <- "Z"
outcome_SE <- "VZ"
cli::cli_bullets(
c("i" =
"Assigning default {.arg outcome_variable} = {.val {outcome_variable}}",
"i" =
"Assigning default {.arg outcome_SE} = {.val {outcome_SE}}")
)
}
data <- data %>%
ungroup %>%
mutate(outcome_colname = outcome_variable,
outcome_SE_colname = outcome_SE)
} else if (rlang::is_character(outcome_variable)) {
# Single value supplied
stopifnot(length(outcome_variable) == 1,
length(outcome_SE) == 1)

data <- data %>%
ungroup %>%
mutate(outcome_colname = outcome_variable,
outcome_SE_colname = outcome_SE)
} else {
# Argument supplied
# expressions argument supplied
matched_formulae_outcome <-
map(outcome_variable,
~ formulae_match(x = names(.x), y = .x))
Expand Down

0 comments on commit ff2e599

Please sign in to comment.