{"id":14068329,"url":"https://github.com/anthonynorth/roxyglobals","last_synced_at":"2025-08-02T02:37:53.919Z","repository":{"id":74237071,"uuid":"294036887","full_name":"anthonynorth/roxyglobals","owner":"anthonynorth","description":"Generate utils::globalVariables() from roxygen tags","archived":false,"fork":false,"pushed_at":"2023-08-22T00:08:03.000Z","size":89,"stargazers_count":52,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-15T16:00:35.361Z","etag":null,"topics":["roxygen2"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anthonynorth.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-09T07:31:20.000Z","updated_at":"2025-03-22T08:13:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac34e698-53c6-42d4-a90d-f1a74a6eef1c","html_url":"https://github.com/anthonynorth/roxyglobals","commit_stats":{"total_commits":54,"total_committers":1,"mean_commits":54.0,"dds":0.0,"last_synced_commit":"ab29bdcd2e618fbfd91356fc22095e961b48333d"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/anthonynorth/roxyglobals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonynorth%2Froxyglobals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonynorth%2Froxyglobals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonynorth%2Froxyglobals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonynorth%2Froxyglobals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anthonynorth","download_url":"https://codeload.github.com/anthonynorth/roxyglobals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonynorth%2Froxyglobals/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268328746,"owners_count":24232929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["roxygen2"],"created_at":"2024-08-13T07:06:06.033Z","updated_at":"2025-08-02T02:37:53.891Z","avatar_url":"https://github.com/anthonynorth.png","language":"R","funding_links":[],"categories":["Manual","R"],"sub_categories":[],"readme":"# roxyglobals\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/anthonynorth/roxyglobals/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/anthonynorth/roxyglobals/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/anthonynorth/roxyglobals/branch/master/graph/badge.svg)](https://app.codecov.io/gh/anthonynorth/roxyglobals?branch=master)\n[![CRAN](https://www.r-pkg.org/badges/version/roxyglobals)](https://CRAN.R-project.org/package=roxyglobals)\n[![r-universe](https://anthonynorth.r-universe.dev/badges/roxyglobals)](https://anthonynorth.r-universe.dev/roxyglobals)\n[![latest](https://img.shields.io/github/r-package/v/anthonynorth/roxyglobals?label=latest\u0026logo=r)](https://github.com/anthonynorth/roxyglobals)\n\u003c!-- badges: end --\u003e\n\nGenerate `utils::globalVariables()` from roxygen @autoglobal and @global tags.\n\n## Installation\n\n```r\n# Install the released version from CRAN\ninstall.packages(\"roxyglobals\")\n\n# Install the released version from r-universe\ninstall.packages(\"roxyglobals\", repos = \"https://anthonynorth.r-universe.dev\")\n\n# Or the development version from GitHub:\n# install.packages(\"remotes\")\nremotes::install_github(\"anthonynorth/roxyglobals\")\n```\n\n## Setup\n\nAdd roxyglobals to an R package DESCRIPTION via:\n\n```r\n# Add to current R package\nroxyglobals::use_roxyglobals()\n\n# Or add to another R package\n# install.packages(\"withr\")\nwithr::with_dir(\"path/to/package\", roxyglobals::use_roxyglobals())\n```\n\n## Config\n\nBy default, roxyglobals writes all discovered globals (including duplicates) to `R/globals.R`. You may configure the filename and global generation behaviour with:\n\n```r\n# write globals to R/generated-globals.R\nroxyglobals::options_set_filename(\"generated-globals.R\")\n\n# only emit unique globals\nroxyglobals::options_set_unique(TRUE)\n```\n\n## Usage\n\nAdd @autoglobal to a function roxygen comment block, example:\n\n```r\n#' Summarise responses\n#'\n#' @name summarise_responses\n#' @param responses a data.frame of responses\n#'\n#' @autoglobal\n#' @export\nsummarise_responses \u003c- function(responses) {\n  # station_name, station_type, end_time, start_time need to be added to \n  # utils::globalVariables() to keep R CMD CHECK happy\n  responses |\u003e\n    dplyr::group_by(station_name, station_type) |\u003e\n    dplyr::summarise(\n      count_responses = dplyr::n(),\n      total_hours = sum(\n        as.numeric(end_time - start_time, units = \"hours\"),\n        na.rm = TRUE\n      ),\n      .groups = \"drop\"\n    )\n}\n```\n\nOr @global, example:\n\n```r\n#' Summarise responses\n#'\n#' @name summarise_responses\n#' @param responses a data.frame of responses\n#'\n#' @global station_name station_type end_time start_time\n#' @export\nsummarise_responses \u003c- function(responses) {\n  # station_name, station_type, end_time, start_time need to be added to \n  # utils::globalVariables() to keep R CMD CHECK happy\n  responses |\u003e\n    dplyr::group_by(station_name, station_type) |\u003e\n    dplyr::summarise(\n      count_responses = dplyr::n(),\n      total_hours = sum(\n        as.numeric(end_time - start_time, units = \"hours\"),\n        na.rm = TRUE\n      ),\n      .groups = \"drop\"\n    )\n}\n```\n\nRun `devtools::document()` to generate `utils::globalVariables()` in your globals file (default `R/globals.R`). Example globals file:\n\n```r\n# Generated by roxyglobals: do not edit by hand\n\nutils::globalVariables(c(\n  \"end_time\", # \u003csummarise_responses\u003e\n  \"start_time\", # \u003csummarise_responses\u003e\n  \"station_name\", # \u003csummarise_responses\u003e\n  \"station_type\", # \u003csummarise_responses\u003e\n  NULL\n))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonynorth%2Froxyglobals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthonynorth%2Froxyglobals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonynorth%2Froxyglobals/lists"}