[R-pkg-devel] Unsure why my package failed pre-check
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-namespaces Namespaces are sealed after loading. Workaround is to create a global variable that is an environment in an `.onLoad` hook, and modify variables in that environment instead.
On July 10, 2022 1:41:12 PM PDT, Edward Wei <edwwei2020 at gmail.com> wrote:
Is the reason my package failed because the functions assign global variables? If this is the case, can I see where it says that functions should not assign global variables? * using log directory 'd:/RCompile/CRANincoming/R-devel/avfintools.Rcheck' * using R Under development (unstable) (2022-07-09 r82572 ucrt) * using platform: x86_64-w64-mingw32 (64-bit) * using session charset: UTF-8 * checking for file 'avfintools/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'avfintools' version '0.1.0' * package encoding: UTF-8 * checking CRAN incoming feasibility ... NOTE Maintainer: 'Edward Wei <edwwei2020 at gmail.com>' New submission Possibly misspelled words in DESCRIPTION: Avfintools (10:18) CRAN (9:34) Vantager (3:55, 10:46, 11:56) alphavantager (8:3, 9:7) api (7:49) * 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 hidden files and directories ... OK * checking for portable file names ... OK * checking whether package 'avfintools' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking for future file timestamps ... 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 R 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 use of S3 registration ... 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 ... [8s] NOTE Found the following assignments to the global environment: File 'avfintools/R/avfintools.R': assign(paste0(ticker, "daily"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(ticker, "15"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(ticker, "15"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(ticker, "wk"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(ticker, "60"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(ticker, "60"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(ticker, "5"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(ticker, "5"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(coin_name, "60"), addreturns(retdata), envir = .GlobalEnv) assign(paste0(coin_name, "daily"), retdata, envir = .GlobalEnv) * checking Rd files ... [1s] OK * checking Rd metadata ... OK * checking Rd line widths ... 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 examples ... [9s] OK * checking PDF version of manual ... OK * checking for detritus in the temp directory ... OK * DONE Status: 2 NOTEs [[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Sent from my phone. Please excuse my brevity.