[R-pkg-devel] "Undefined global functions or variables" locally but NOT on GitHub

John Benninghoff jbenn|ngho|| @end|ng |rom m@c@com
Tue Oct 14 22:50:27 CEST 2025


As Chris Black pointed out, you can use `::`. The help page for `data()` recommends this approach for Spencer’s use case:

"In the unusual case that a package uses a lazy-loaded dataset as a default argument to a function, that needs to be specified by :: <http://127.0.0.1:16056/help/library/utils/help/%3A%3A>, e.g., survival::survexp.us."


> On Oct 14, 2025, at 3:38 AM, Georgi Boshnakov <georgi.boshnakov using manchester.ac.uk> wrote:
> 
> Datasets are somewhat special, in that they are not in the namespace of the package. So, you can't access them with the '::' operator, you need to use data(). When inside functions, preferably with envir = environment() to avoid putting the datasets in the user's workspace, see the help page of data().
> 
> Georgi Boshnakov
> 
> ________________________________________
> From: R-package-devel <r-package-devel-bounces using r-project.org <mailto:r-package-devel-bounces using r-project.org>> on behalf of Spencer Graves <spencer.graves using effectivedefense.org <mailto:spencer.graves using effectivedefense.org>>
> Sent: 14 October 2025 00:03
> To: r-package-devel using r-project.org <mailto:r-package-devel using r-project.org>
> Subject: [R-pkg-devel] "Undefined global functions or variables" locally but NOT on GitHub
> 
> Hello, All:
> 
> 
> GitHub actions has seen no problems with:
> 
> 
> https://urldefense.com/v3/__https://github.com/sbgraves237/MaddisonData__;!!PDiH4ENfjr2_Jw!AV0E6CfZS8E1jXuDa5DiIi0ORXQzjlJGiZYd5YBVl6_i05LSgAXspPn4jj-Afy87jGSuyd2V30E2t9n-P_gyU7t7pRJGtHyLWV9CXc2TIzbRfGQ$ [github[.]com]
> 
> 
> However, R CMD check on my local computer cannot find any of the
> datasets defined in this package. I think I have the current version of
> everything including upgrading macOS to 26.0.1, upgrading RStudio and
> running "update.packages()". I've studied Wickham and Bryan, R Packages,
> without finding how to fix this problem. I've compared the roxygen2 code
> in this package with data documentation in other tidyverse packages
> without being able to resolve this issue. Below please find
> sessionInfo() and 00check.log from "R CMD check MaddisonData_0.0.1.tar.gz".
> 
> 
> Suggestions? Thanks, Spencer Graves
> 
> 
> p.s. I was having the same problem with
> "github.com/sbgraves237/SS4Maddison", so I created the MaddisonData
> project from scratch and copied only what I needed from SS4Maddison. The
> problem followed me.
> 
> 
>> sessionInfo()
> R version 4.5.1 (2025-06-13)
> Platform: aarch64-apple-darwin20
> Running under: macOS Tahoe 26.0.1
> 
> Matrix products: default
> BLAS:
> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
> 
> LAPACK:
> /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;
>  LAPACK version 3.12.1
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> time zone: America/Chicago
> tzcode source: internal
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets
> [6] methods   base
> 
> other attached packages:
> [1] devtools_2.4.6 usethis_3.2.1
> 
> loaded via a namespace (and not attached):
>  [1] R6_2.6.1           fastmap_1.2.0
>  [3] magrittr_2.0.4     cachem_1.1.0
>  [5] remotes_2.5.0.9000 glue_1.8.0
>  [7] memoise_2.0.1      lifecycle_1.0.4
>  [9] cli_3.6.5          sessioninfo_1.2.3
> [11] vctrs_0.6.5        compiler_4.5.1
> [13] pkgload_1.4.1      tools_4.5.1
> [15] purrr_1.1.0        rstudioapi_0.17.1
> [17] pkgbuild_1.4.8     ellipsis_0.3.2
> [19] rlang_1.1.6        fs_1.6.6
> 
> 
> ##################
> 
> 
> 00check.log
> 
> 
> * using log directory
> ‘/Users/sg/Documents/current/R/MaddisonData/MaddisonData.Rcheck’
> * using R version 4.5.1 (2025-06-13)
> * using platform: aarch64-apple-darwin20
> * R was compiled by
>     Apple clang version 16.0.0 (clang-1600.0.26.6)
>     GNU Fortran (GCC) 14.2.0
> * running under: macOS Tahoe 26.0.1
> * using session charset: UTF-8
> * checking for file ‘MaddisonData/DESCRIPTION’ ... OK
> * this is package ‘MaddisonData’ version ‘0.0.1’
> * package encoding: UTF-8
> * checking package namespace information ... OK
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking if there is a namespace ... OK
> * checking for executable files ... OK
> * checking for hidden files and directories ... OK
> * checking for portable file names ... OK
> * checking for sufficient/correct file permissions ... OK
> * checking whether package ‘MaddisonData’ can be installed ... OK
> * checking installed package size ... INFO
>   installed size is  5.1Mb
>   sub-directories of 1Mb or more:
>     extdata   4.7Mb
> * checking package directory ... OK
> * checking ‘build’ directory ... OK
> * checking DESCRIPTION meta-information ... OK
> * checking top-level files ... OK
> * checking for left-over files ... OK
> * checking index information ... OK
> * checking package subdirectories ... OK
> * checking code files for non-ASCII characters ... OK
> * checking R files for syntax errors ... OK
> * checking whether the package can be loaded ... OK
> * checking whether the package can be loaded with stated dependencies ... OK
> * checking whether the package can be unloaded cleanly ... OK
> * checking whether the namespace can be loaded with stated dependencies
> ... OK
> * checking whether the namespace can be unloaded cleanly ... OK
> * checking loading without being on the library search path ... OK
> * checking dependencies in R code ... OK
> * checking S3 generic/method consistency ... OK
> * checking replacement functions ... OK
> * checking foreign function calls ... OK
> * checking R code for possible problems ... NOTE
> getMaddisonSources: no visible binding for global variable
>   ‘MaddisonSources’
> getMaddisonSources: no visible binding for global variable
>   ‘MaddisonYears’
> logMaddison: no visible binding for global variable ‘MaddisonData’
> logMaddison: no visible binding for global variable ‘MaddisonCountries’
> Undefined global functions or variables:
>   MaddisonCountries MaddisonData MaddisonSources MaddisonYears
> * checking Rd files ... OK
> * checking Rd metadata ... OK
> * checking Rd cross-references ... OK
> * checking for missing documentation entries ... OK
> * checking for code/documentation mismatches ... OK
> * checking Rd \usage sections ... OK
> * checking Rd contents ... OK
> * checking for unstated dependencies in examples ... OK
> * checking contents of ‘data’ directory ... OK
> * checking data for non-ASCII characters ... OK
> * checking LazyData ... OK
> * checking data for ASCII and uncompressed saves ... OK
> * checking installed files from ‘inst/doc’ ... OK
> * checking files in ‘vignettes’ ... OK
> * checking examples ... OK
> * checking for unstated dependencies in vignettes ... OK
> * checking package vignettes ... OK
> * checking re-building of vignette outputs ... OK
> * checking PDF version of manual ... OK
> * DONE
> Status: 1 NOTE
> 
> ______________________________________________
> R-package-devel using r-project.org <mailto:R-package-devel using r-project.org> mailing list
> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-package-devel__;!!PDiH4ENfjr2_Jw!AV0E6CfZS8E1jXuDa5DiIi0ORXQzjlJGiZYd5YBVl6_i05LSgAXspPn4jj-Afy87jGSuyd2V30E2t9n-P_gyU7t7pRJGtHyLWV9CXc2TBzk31as$ [stat[.]ethz[.]ch]
> 
> ______________________________________________
> R-package-devel using r-project.org <mailto:R-package-devel using r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list