R Under development (unstable) (2026-07-17 r90265 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Regression test for audit item 9: internal cleanups (behavior-neutral). > # > # Covers: > # - R/zzz.R no longer creates NULL bindings shadowing base/stats functions > # (sd, quantile, runif, na.omit, data) in the bootnet namespace. > # - estimateNetwork(default = "pcor") still runs (backward-compat detail; > # exact values are asserted in test-backcompat.R). > # - bootnet(, default = "graphicalVAR") errors with the informative > # message, not match.arg()'s generic "should be one of" error. > > library(bootnet) Loading required package: ggplot2 This is bootnet 1.9.1 For questions and issues, please see github.com/SachaEpskamp/bootnet. > > ## --- No NULL shadow bindings remain in the namespace -------------------------- > ns <- asNamespace("bootnet") > for (nm in c("sd", "quantile", "runif", "na.omit", "data")) { + # Either the name is not bound in the package namespace at all (it resolves + # to the imported stats/utils function via the imports environment), or if it + # is bound it must be the actual function -- never a NULL shadow. + ok <- !exists(nm, envir = ns, inherits = FALSE) || + is.function(get(nm, envir = ns, inherits = FALSE)) + stopifnot(ok) + } > # The old fooling block explicitly assigned NULL; make sure none of these are NULL. > for (nm in c("sd", "quantile", "runif", "na.omit", "data", "P", "fill", "label")) { + if (exists(nm, envir = ns, inherits = FALSE)) { + stopifnot(!is.null(get(nm, envir = ns, inherits = FALSE))) + } + } > > ## --- pcor estimation smoke check --------------------------------------------- > set.seed(1) > d <- matrix(rnorm(60 * 4), ncol = 4) > net <- estimateNetwork(d, default = "pcor", verbose = FALSE) > stopifnot(inherits(net, "bootnetResult")) > stopifnot(is.matrix(net$graph)) > > ## --- graphicalVAR informative error before match.arg ------------------------- > err <- tryCatch( + bootnet(d, default = "graphicalVAR"), + error = function(e) conditionMessage(e) + ) > stopifnot(is.character(err)) > stopifnot(grepl("only supported for output of estimateNetwork", err, fixed = TRUE)) > # Confirm it is NOT the generic match.arg error. > stopifnot(!grepl("should be one of", err)) > > cat("item09-cleanups: OK\n") item09-cleanups: OK > > proc.time() user system elapsed 4.35 0.87 5.29