R Under development (unstable) (2025-06-04 r88278 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 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. > ## This runs testme test script inst/testme/test-globals,formulas.R > ## Don't edit - it was autogenerated by inst/testme/deploy.R > future.callr:::testme("globals,formulas") Test 'globals,formulas' ... Sourcing 9 prologue scripts ... 01/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/001.load.R' 02/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/002.record-state.R' 03/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/030.imports.R' 04/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/050.utils.R' 05/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/090.context.R' 06/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/090.options.R' 07/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/091.envvars.R' 08/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/099.future-setup.R' 09/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/995.detrius-connections.R' Sourcing 9 prologue scripts ... done Running test script: 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/test-globals,formulas.R' > library(future.callr) Loading required package: future > library("datasets") > library("stats") > plan(callr) > message("*** Globals - formulas ...") *** Globals - formulas ... > message("*** Globals - lm() ...") *** Globals - lm() ... > ctl <- c(4.17, 5.58, 5.18, 6.11, 4.5, 4.61, 5.17, + 4.53, 5.33, 5.14) > trt <- c(4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, + 4.89, 4.32, 4.69) > group <- gl(2, 10, 20, labels = c("Ctl", "Trt")) > weight <- c(ctl, trt) > fit0 <- lm(weight ~ group - 1) > print(fit0) Call: lm(formula = weight ~ group - 1) Coefficients: groupCtl groupTrt 5.032 4.661 > f <- future({ + lm(weight ~ group - 1) + }) > fit <- value(f) > print(fit) Call: lm(formula = weight ~ group - 1) Coefficients: groupCtl groupTrt 5.032 4.661 > stopifnot(all.equal(fit, fit0)) > fit %<-% { + lm(weight ~ group - 1) + } > print(fit) Call: lm(formula = weight ~ group - 1) Coefficients: groupCtl groupTrt 5.032 4.661 > stopifnot(all.equal(fit, fit0)) > message("*** Globals - lm() ... DONE") *** Globals - lm() ... DONE > message("*** Globals - one-side formulas, e.g. xtabs(~ x) ...") *** Globals - one-side formulas, e.g. xtabs(~ x) ... > x <- c(1, 1, 2, 2, 2) > tbl0 <- xtabs(~x) > print(tbl0) x 1 2 2 3 > f <- future({ + xtabs(~x) + }) > tbl <- value(f) > print(tbl) x 1 2 2 3 > stopifnot(all.equal(tbl, tbl0)) > tbl %<-% { + xtabs(~x) + } > print(tbl) x 1 2 2 3 > stopifnot(all.equal(tbl, tbl0)) > message("*** Globals - one-side formulas, e.g. xtabs(~ x) ... DONE") *** Globals - one-side formulas, e.g. xtabs(~ x) ... DONE > message("*** Globals - lm(, data = cars) ...") *** Globals - lm(, data = cars) ... > exprs <- list(a = substitute({ + lm(dist ~ . - 1, data = cars) + }), b = substitute({ + lm(dist ~ . + 0, data = cars) + }), c = substitute({ .... [TRUNCATED] > for (kk in seq_along(exprs)) { + expr <- exprs[[kk]] + name <- names(exprs)[kk] + mdebugf("- Globals - lm(, data = car ..." ... [TRUNCATED] Call: lm(formula = dist ~ . - 1, data = cars) Coefficients: speed 2.909 Call: lm(formula = dist ~ . - 1, data = cars) Coefficients: speed 2.909 Call: lm(formula = dist ~ . + 0, data = cars) Coefficients: speed 2.909 Call: lm(formula = dist ~ . + 0, data = cars) Coefficients: speed 2.909 Call: lm(formula = dist ~ speed + speed^2, data = cars) Coefficients: (Intercept) speed -17.579 3.932 Call: lm(formula = dist ~ speed + speed^2, data = cars) Coefficients: (Intercept) speed -17.579 3.932 Call: lm(formula = dist ~ speed + I(speed^2), data = cars) Coefficients: (Intercept) speed I(speed^2) 2.47014 0.91329 0.09996 Call: lm(formula = dist ~ speed + I(speed^2), data = cars) Coefficients: (Intercept) speed I(speed^2) 2.47014 0.91329 0.09996 Call: lm(formula = dist ~ poly(speed, 2), data = cars) Coefficients: (Intercept) poly(speed, 2)1 poly(speed, 2)2 42.98 145.55 23.00 Call: lm(formula = dist ~ poly(speed, 2), data = cars) Coefficients: (Intercept) poly(speed, 2)1 poly(speed, 2)2 42.98 145.55 23.00 > message("*** Globals - lm(, data = cars) ... DONE") *** Globals - lm(, data = cars) ... DONE > message("*** Globals - map(x, ~ expr) ...") *** Globals - map(x, ~ expr) ... > map <- function(.x, .f, ...) { + if (inherits(.f, "formula")) { + expr <- .f[[-1]] + .f <- eval(bquote(function(...) { + .... [TRUNCATED] > inner_function <- function(x) { + x + 1 + } > outer_function <- function(x) { + map(1:2, ~inner_function(.x)) + } > y0 <- outer_function(1) > str(y0) List of 2 $ : num [1:2] 2 3 $ : num [1:2] 2 3 > f <- future({ + outer_function(1) + }) > y <- value(f) > str(y) List of 2 $ : num [1:2] 2 3 $ : num [1:2] 2 3 > stopifnot(all.equal(y, y0)) > y %<-% { + outer_function(1) + } > str(y) List of 2 $ : num [1:2] 2 3 $ : num [1:2] 2 3 > stopifnot(all.equal(y, y0)) > message("*** Globals - map(x, ~ expr) ... DONE") *** Globals - map(x, ~ expr) ... DONE > message("*** Globals - formulas ... DONE") *** Globals - formulas ... DONE Sourcing 6 epilogue scripts ... 01/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/001.undo-future.R' 02/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/002.undo-state.R' Failed to undo environment variables: - Expected environment variables: [n=213] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', ..., 'tempdirname' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: 03/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/090.gc.R' 04/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/099.session_info.R' 05/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/995.detritus-connections.R' 06/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/999.detritus-files.R' Skipping, because path appears not to be an 'R CMD check' folder: 'D:/temp/2025_06_05_18_50_16_8598' Sourcing 6 epilogue scripts ... done Test time: user.self=2s, sys.self=0.2s, elapsed=8s, user.child=NAs, sys.child=NAs Test 'tempdirname' ... success > > proc.time() user system elapsed 1.90 0.31 8.29