Skip to content

Commit

Permalink
remove deprecated purrr::map_dfr calls and replace with `purrr::map…
Browse files Browse the repository at this point in the history
…` -> `purrr::list_rbind`
  • Loading branch information
joshyam-k committed Nov 19, 2024
1 parent 3c4111f commit d477350
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ importFrom(furrr,future_map)
importFrom(furrr,future_map2)
importFrom(progressr,progressor)
importFrom(progressr,with_progress)
importFrom(purrr,list_rbind)
importFrom(purrr,map)
importFrom(purrr,map2)
importFrom(purrr,map_dfr)
importFrom(rlang,sym)
useDynLib(saeczi, .registration = TRUE)
14 changes: 9 additions & 5 deletions R/saeczi.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#' @importFrom dplyr summarise group_by mutate left_join
#' @importFrom progressr progressor with_progress
#' @importFrom furrr future_map furrr_options future_map2
#' @importFrom purrr map map2 map_dfr
#' @importFrom purrr map map2 list_rbind

saeczi <- function(samp_dat,
pop_dat,
Expand Down Expand Up @@ -143,19 +143,23 @@ saeczi <- function(samp_dat,
))

beta_lm_mat <- res |>
map_dfr(.f = ~ .x$beta_lm) |>
map(.f = ~ as.data.frame(t(.x$beta_lm))) |>
list_rbind() |>
as.matrix()

beta_glm_mat <- res |>
map_dfr(.f = ~ .x$beta_glm) |>
map(.f = ~ as.data.frame(t(.x$beta_glm))) |>
list_rbind() |>
as.matrix()

u_lm <- res |>
map_dfr(.f = ~ .x$u_lm) |>
map(.f = ~ as.data.frame(t(.x$u_lm))) |>
list_rbind() |>
as.matrix()

u_glm <- res |>
map_dfr(.f = ~ .x$u_glm) |>
map(.f = ~ as.data.frame(t(.x$u_glm))) |>
list_rbind() |>
as.matrix()

u_lm[is.na(u_lm)] <- 0
Expand Down
12 changes: 8 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,23 @@ boot_rep_par <- function(x,
.options = furrr_options(seed = TRUE))

beta_lm_mat <- res |>
map_dfr(.f = ~ .x$beta_lm) |>
map(.f = ~ as.data.frame(t(.x$beta_lm))) |>
list_rbind() |>
as.matrix()

beta_glm_mat <- res |>
map_dfr(.f = ~ .x$beta_glm) |>
map(.f = ~ as.data.frame(t(.x$beta_glm))) |>
list_rbind() |>
as.matrix()

u_lm <- res |>
map_dfr(.f = ~ .x$u_lm) |>
map(.f = ~ as.data.frame(t(.x$u_lm))) |>
list_rbind() |>
as.matrix()

u_glm <- res |>
map_dfr(.f = ~ .x$u_glm) |>
map(.f = ~ as.data.frame(t(.x$u_glm))) |>
list_rbind() |>
as.matrix()


Expand Down

0 comments on commit d477350

Please sign in to comment.