tidyverse / dplyr

dplyr: A grammar of data manipulation
https://dplyr.tidyverse.org/
Other
4.78k stars 2.12k forks source link

dplyr::cur_column don't support dtplyr #7102

Open Longfei2 opened 2 weeks ago

Longfei2 commented 2 weeks ago

Please run these codes, and it will yeild an error message.

a <- data.frame(x1 =c(0, 1), x2 =c(1,0)) %>%
  dtplyr::lazy_dt() %>%
  dplyr::mutate(dplyr::across(.cols = c("x1", "x2"),
                                .fns = ~ ifelse(is.na(.x) | !.x, "", sub("x", "", dplyr::cur_column()
                                                                         )
                                                )
                                )
                  ) %>%
  dplyr::as_tibble()

I looked into this issue, and I found the objects from environment dplyr:::context_env will leave empty. Image