Skip to content

@autoglobal does not record . in globals.R #12

@joshwlambert

Description

@joshwlambert

Thanks for developing this great package!

I'm using @autoglobal in a package that uses {data.table}. {data.table} syntax allows list() to be replaced with .(), which is detected by R CMD check (devtools::check()) as:

checking R code for possible problems ... NOTE
  foo: no visible global function definition for.Undefined global functions or variables:
    .

Here is an example function that would produce this check note:

#' Subset a `<data.table>`
#'
#' @param x A `<data.table>` including columns `$a` and `$b`.
#'
#' @return A `<data.table>`
#' @autoglobal
#' @export
#'
#' @examples
#' if (requireNamespace("data.table", quietly = TRUE)) {
#'   dt <- data.table::data.table(a = 1:10, b = 11:20, c = letters[1:10])
#'   foo(x = dt)
#' }
foo <- function(x) {
  x[, .(a, b)]
}

It would be great if @autoglobal could also add . to the globals.R file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions