global_roclet: Roclet: global

View source: R/global_roclet.R

global_rocletR Documentation

Roclet: global

Description

This roclet automates utils::globalVariables() declaration from @global and @autoglobal roxygen tags.

Package authors will not typically need to invoke global_roclet() directly. Global roclet instances are created by roxygen2 during roxygen2::roxygenise() (or devtools::document()).

Usage

global_roclet()

Value

A roxygen2::roclet() instance for declaring utils::globalVariables() during roxygen2::roxygenise()

Examples

#' @autoglobal
foo <- function(x) {
  # bar isn't declared -> add to utils::globalVariables()
  subset(x, bar == 4)
}

#' @global bar
foo <- function(x) {
  # bar is explicitly defined as a global -> add to utils::globalVariables()
  subset(x, bar == 4)
}

roxyglobals documentation built on Aug. 21, 2023, 5:14 p.m.