The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Generate utils::globalVariables()
from roxygen @autoglobal and @global tags.
# Install the released version from CRAN
install.packages("roxyglobals")
# Install the released version from r-universe
install.packages("roxyglobals", repos = "https://anthonynorth.r-universe.dev")
# Or the development version from GitHub:
# install.packages("remotes")
::install_github("anthonynorth/roxyglobals") remotes
Add roxyglobals to an R package DESCRIPTION via:
# Add to current R package
::use_roxyglobals()
roxyglobals
# Or add to another R package
# install.packages("withr")
::with_dir("path/to/package", roxyglobals::use_roxyglobals()) withr
By default, roxyglobals writes all discovered globals (including
duplicates) to R/globals.R
. You may configure the filename
and global generation behaviour with:
# write globals to R/generated-globals.R
::options_set_filename("generated-globals.R")
roxyglobals
# only emit unique globals
::options_set_unique(TRUE) roxyglobals
Add @autoglobal to a function roxygen comment block, example:
#' Summarise responses
#'
#' @name summarise_responses
#' @param responses a data.frame of responses
#'
#' @autoglobal
#' @export
<- function(responses) {
summarise_responses # station_name, station_type, end_time, start_time need to be added to
# utils::globalVariables() to keep R CMD CHECK happy
|>
responses ::group_by(station_name, station_type) |>
dplyr::summarise(
dplyrcount_responses = dplyr::n(),
total_hours = sum(
as.numeric(end_time - start_time, units = "hours"),
na.rm = TRUE
),.groups = "drop"
) }
Or @global, example:
#' Summarise responses
#'
#' @name summarise_responses
#' @param responses a data.frame of responses
#'
#' @global station_name station_type end_time start_time
#' @export
<- function(responses) {
summarise_responses # station_name, station_type, end_time, start_time need to be added to
# utils::globalVariables() to keep R CMD CHECK happy
|>
responses ::group_by(station_name, station_type) |>
dplyr::summarise(
dplyrcount_responses = dplyr::n(),
total_hours = sum(
as.numeric(end_time - start_time, units = "hours"),
na.rm = TRUE
),.groups = "drop"
) }
Run devtools::document()
to generate
utils::globalVariables()
in your globals file (default
R/globals.R
). Example globals file:
# Generated by roxyglobals: do not edit by hand
::globalVariables(c(
utils"end_time", # <summarise_responses>
"start_time", # <summarise_responses>
"station_name", # <summarise_responses>
"station_type", # <summarise_responses>
NULL
))
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.