Skip to content

Commit

Permalink
#118 fix: conditional application of log_transform_yi
Browse files Browse the repository at this point in the history
----

Was returning only the first column as a vector rather than entire output of log_transform_yi() because `ifelse()` returns vectors dummy!
  • Loading branch information
egouldo committed Aug 23, 2024
1 parent 4ceec4d commit fe6ee93
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions R/standardise_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,16 @@ log_transform_response <- function(data, sim = 10000L, ...) {
"back_transformed_data"
)
) %>%
dplyr::group_by(id_col) %>%
dplyr::mutate(back_transformed_data =
map(.x = back_transformed_data,
.f = ~ ifelse(!rlang::is_na(.x),
log_transform_yi(.x, sim = sim),
NA))) %>%
ungroup()
purrr::map(
.x = back_transformed_data,
.f = ~ if (!rlang::is_na(.x)) {
log_transform_yi(.x, sim = sim)
} else {
NA
}
),
.by = "id_col")

return(out)
}

0 comments on commit fe6ee93

Please sign in to comment.