ThinkR-open / checkhelper

A package to help deal with devtools::check outputs
https://thinkr-open.github.io/checkhelper/
Other
34 stars 4 forks source link

`:=` is not detected in Undefined global functions or variables #83

Closed VincentGuyader closed 8 months ago

VincentGuyader commented 9 months ago

let say we have a function like this :

#' Title
#'
#' @param data data
#' @param a a
#'
#' @export
#' @importFrom dplyr rename
my_function <- function(data, a = "Species"){

  data |>
    rename({{a}}:= choup)

}

this will generate a NOTE in check

image

but the recommendation dont include := in globalVariable but to be added in NAMESPACE

image

but we cant do this : image because :

image

a working solution will be :

globalVariables(unique(c(
  # my_function:
  "choup",":="
)))
statnmap commented 8 months ago

You need to use @importFrom rlang ":='"