Skip to content
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

Drop use of dplyr::cur_data() it was deprecated as of dplyr 1.1.0 use dplyr::pick() instead #379

Closed
spsanderson opened this issue Dec 7, 2023 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@spsanderson
Copy link
Owner

spsanderson commented Dec 7, 2023

Drop use of dplyr::cur_data() it was deprecated as of dplyr 1.1.0 use dplyr::pick() instead

Example:

library(TidyDensity)

param_list = list(
  .n = 50,
  .mean = c(-1, 0, 1),
  .sd = 1,
  .num_sims = 3,
  .return_tibble = TRUE
)

td <- "tidy_normal"

param_grid <- expand.grid(param_list)

names(param_grid) <- methods::formalArgs(td)
param_grid <- param_grid[,1:4]
param_grid

df <- param_grid |>
  dplyr::mutate(results = purrr::pmap(dplyr::pick(dplyr::everything()), match.fun(td)))

df |>
  tidyr::unnest(results) |>
  head(10)

# A tibble: 10 × 11
      .n .mean   .sd .num_sims sim_number     x      y    dx       dy      p      q
   <dbl> <dbl> <dbl>     <dbl> <fct>      <int>  <dbl> <dbl>    <dbl>  <dbl>  <dbl>
 1    50    -1     1         3 1              1 -2.70  -4.99 0.000305 0.0445 -2.70 
 2    50    -1     1         3 1              2 -0.799 -4.83 0.000815 0.580  -0.799
 3    50    -1     1         3 1              3 -0.466 -4.67 0.00196  0.703  -0.466
 4    50    -1     1         3 1              4  0.468 -4.51 0.00428  0.929   0.468
 5    50    -1     1         3 1              5 -1.10  -4.35 0.00844  0.460  -1.10 
 6    50    -1     1         3 1              6 -0.515 -4.19 0.0151   0.686  -0.515
 7    50    -1     1         3 1              7 -1.96  -4.03 0.0248   0.169  -1.96 
 8    50    -1     1         3 1              8 -0.566 -3.87 0.0373   0.668  -0.566
 9    50    -1     1         3 1              9 -1.48  -3.71 0.0521   0.315  -1.48 
10    50    -1     1         3 1             10 -1.03  -3.55 0.0682   0.486  -1.03 
@spsanderson spsanderson added bug Something isn't working enhancement New feature or request labels Dec 7, 2023
@spsanderson spsanderson added this to the TidyDensity 1.3.0 milestone Dec 7, 2023
@spsanderson spsanderson self-assigned this Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Development

No branches or pull requests

1 participant