From a6e52d51752a4c8bedc14f34abfe95791bc8e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Fory=C5=9B?= Date: Thu, 25 Jul 2024 00:30:24 +0200 Subject: [PATCH] Fix tidyselect issue (#72) * Fix tidyselect depreceted warning issue. * Bump branch-names version * Register cnd_df method for mutate I noticed that were missing this `S3method(mutate,cnd_df)` in the NAMESPACE. I think we should use @export always now on methods and roxygen2 will do the right thing: see https://www.tidyverse.org/blog/2024/01/roxygen2-7-3-0/. --------- Co-authored-by: Ramiro Magno --- .github/workflows/r-renv-lock.yml | 2 +- NAMESPACE | 1 + R/cnd_df.R | 4 ++-- man/mutate.cnd_df.Rd | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/r-renv-lock.yml b/.github/workflows/r-renv-lock.yml index 44142a3d..1eff1f70 100644 --- a/.github/workflows/r-renv-lock.yml +++ b/.github/workflows/r-renv-lock.yml @@ -36,7 +36,7 @@ jobs: steps: - name: Get branch names id: branch-name - uses: tj-actions/branch-names@v5.4 + uses: tj-actions/branch-names@v8 - name: Checkout repo (PR) 🛎 uses: actions/checkout@v3 diff --git a/NAMESPACE b/NAMESPACE index ae0b7a9d..7414dfc1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand S3method(ctl_new_rowid_pillar,cnd_df) +S3method(mutate,cnd_df) S3method(print,iso8601) S3method(tbl_sum,cnd_df) export("%.>%") diff --git a/R/cnd_df.R b/R/cnd_df.R index 9d3dedb9..4a80a222 100644 --- a/R/cnd_df.R +++ b/R/cnd_df.R @@ -416,7 +416,7 @@ condition_add <- function(dat, ..., .na = NA, .dat2 = rlang::env()) { #' #' @inheritParams dplyr::mutate #' @importFrom dplyr mutate -#' @keywords internal +#' @export mutate.cnd_df <- function(.data, ..., .by = NULL, @@ -440,5 +440,5 @@ mutate.cnd_df <- function(.data, lst <- purrr::map(derivations, ~ rlang::expr(dplyr::if_else(!!cnd, !!.x, NA))) lst <- rlang::set_names(lst, derived_vars) - dplyr::mutate(dat, !!!lst, .by = NULL, .keep = .keep, .after = .after) + dplyr::mutate(dat, !!!lst, .by = NULL, .keep = .keep, .after = dplyr::all_of(.after)) } diff --git a/man/mutate.cnd_df.Rd b/man/mutate.cnd_df.Rd index a11b38fd..29b1d4fc 100644 --- a/man/mutate.cnd_df.Rd +++ b/man/mutate.cnd_df.Rd @@ -65,4 +65,3 @@ cnd_df <- condition_add(df, x > 1L, y \%in\% c("a", "b")) dplyr::mutate(cnd_df, z = "match") } -\keyword{internal}