You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a list-column with functions. Each function should depend on arguments from that tibble row, so I'm using purrr::partial().
It seems that it's impossible to reproduce the .lazy = FALSE behavior with the !! syntax.
# works, but deprecatedtibble::tibble(x=1:3) |>dplyr::rowwise() |>dplyr::mutate(square_root=list(purrr::partial(sqrt, x, .lazy=FALSE)))
#> Warning: There were 3 warnings in `dplyr::mutate()`.#> The first warning was:#> ℹ In argument: `square_root = list(purrr::partial(sqrt, x, .lazy = FALSE))`.#> ℹ In row 1.#> Caused by warning:#> ! The `.lazy` argument of `partial()` is deprecated as of purrr 0.3.0.#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 2 remaining warnings.#> # A tibble: 3 × 2#> # Rowwise: #> x square_root#> <int> <list> #> 1 1 <prrr_fn_> #> 2 2 <prrr_fn_> #> 3 3 <prrr_fn_># failstibble::tibble(x=1:3) |>dplyr::rowwise() |>dplyr::mutate(square_root=list(purrr::partial(sqrt, !!x)))
#> Error in quos(..., .ignore_empty = "all"): object 'x' not found# failstibble::tibble(x=1:3) |>dplyr::rowwise() |>dplyr::mutate(square_root=list(purrr::partial(sqrt, !!.data$x)))
#> Error in quos(..., .ignore_empty = "all"): object '.data' not found
The problem is that the !! is getting evaluated by mutate instead of by partial(). I think the easiest way to work around this is to just construct the function factory yourself:
I'm trying to create a list-column with functions. Each function should depend on arguments from that tibble row, so I'm using
purrr::partial()
.It seems that it's impossible to reproduce the
.lazy = FALSE
behavior with the!!
syntax.Created on 2023-04-20 with reprex v2.0.2
CC @klmr
The text was updated successfully, but these errors were encountered: