R Under development (unstable) (2025-11-17 r89032 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 file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview > # * https://testthat.r-lib.org/articles/special-files.html > > library(testthat) > library(macro) Loading required package: common > > test_check("macro") ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test0.R - File Out: .//programs/test0_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ ]: #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# [ 2][ ]: #% Assign macro variables [ 3][ ]: #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# [ 4][ ]: #%let x = 2 [ 5][ ]: #%let y = floor(1 + 2.5) [ 6][ ]: #%let z = 3 [ 7][ 1]: [ 8][ 2]: # Initial comment [ 9][ 3]: print("Starting program") [ 10][ 4]: SYMBOLGEN: &x = 2 [ 11][ ]: #%if (&x == 1) [ 12][ ]: [ 13][ ]: print("X is one") [ 14][ ]: print("another one") [ 15][ ]: [ 16][ ]: #%end SYMBOLGEN: &x = 2 [ 17][ ]: #%if (&x == 2) [ 18][ ]: [ 19][ 5]: print("X is two") [ 20][ 6]: print("another one") [ 21][ 7]: [ 22][ ]: #%end SYMBOLGEN: &x = 2 [ 23][ ]: #%if (&x. > 2) [ 24][ ]: [ 25][ ]: print("X is &x.") [ 26][ ]: print("another one") [ 27][ ]: [ 28][ ]: #%end [ 29][ ]: [ 30][ 8]: # Resolved assignment SYMBOLGEN: &y = floor(1 + 2.5) [ 31][ 9]: a <- floor(1 + 2.5) [ 32][ 10]: [ 33][ 11]: # Results [ 34][ 12]: print(paste("a is", a)) [ 35][ 13]: print("y is y.") [ 36][ 14]: print("z is z.") ******************************************************************************** ** Execution ******************************************************************************** > print("Starting program") [1] "Starting program" > print("X is two") [1] "X is two" > print("another one") [1] "another one" > a <- floor(1 + 2.5) > print(paste("a is", a)) [1] "a is 3" > print("y is y.") [1] "y is y." > print("z is z.") [1] "z is z." ******************************************************************************** ** End ******************************************************************************** --------- # Here is a normal comment print("z is 6") # Comment something print("X is 3") a <- 3 print(paste("z is", 6)) print("Y is 4") b <- 4 q <- floor(2 + 2.5) d <- 6 f <- TRUE g <- FALSE --------- [1] "z is 6" [1] "X is 3" [1] "z is 6" [1] "Y is 4" ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test2.R - File Out: .//programs/test2_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ ]: #%let x = c("mpg", "cyl", "disp") [ 4][ ]: #%let y = mpg > 20 [ 5][ ]: SYMBOLGEN: &x = c("mpg", "cyl", "disp") [ 6][ 2]: print(c("mpg", "cyl", "disp")) [ 7][ 3]: SYMBOLGEN: &x = c("mpg", "cyl", "disp") [ 8][ ]: #%if length(&x.) == 1 [ 9][ ]: [ 10][ ]: print("X is one") [ 11][ ]: SYMBOLGEN: &x = c("mpg", "cyl", "disp") [ 12][ ]: #%elseif (length(&x.) == 2) [ 13][ ]: [ 14][ ]: print("X is two") [ 15][ ]: [ 16][ ]: #%else [ 17][ ]: [ 18][ 4]: print("X is something else") SYMBOLGEN: &x = c("mpg", "cyl", "disp") [ 19][ 5]: resx <- c("mpg", "cyl", "disp") SYMBOLGEN: &x = c("mpg", "cyl", "disp") SYMBOLGEN: &y = mpg > 20 [ 20][ 6]: dat <- subset(mtcars, subset = mpg > 20, select = c("mpg", "cyl", "disp")) [ 21][ 7]: [ 22][ 8]: print(dat) [ 23][ 9]: [ 24][ ]: #%end [ 25][ ]: ******************************************************************************** ** Execution ******************************************************************************** > print(c("mpg", "cyl", "disp")) [1] "mpg" "cyl" "disp" > print("X is something else") [1] "X is something else" > resx <- c("mpg", "cyl", "disp") > dat <- subset(mtcars, subset = mpg > 20, select = c("mpg", + "cyl", "disp")) > print(dat) mpg cyl disp Mazda RX4 21.0 6 160.0 Mazda RX4 Wag 21.0 6 160.0 Datsun 710 22.8 4 108.0 Hornet 4 Drive 21.4 6 258.0 Merc 240D 24.4 4 146.7 Merc 230 22.8 4 140.8 Fiat 128 32.4 4 78.7 Honda Civic 30.4 4 75.7 Toyota Corolla 33.9 4 71.1 Toyota Corona 21.5 4 120.1 Fiat X1-9 27.3 4 79.0 Porsche 914-2 26.0 4 120.3 Lotus Europa 30.4 4 95.1 Volvo 142E 21.4 4 121.0 ******************************************************************************** ** End ******************************************************************************** --------- print("X is two") resx <- "two" --------- [1] "X is two" --------- print("X is one and Y is y.") resx <- "one" resy <- 2 --------- [1] "X is one and Y is y." --------- # Assign integer value v1 <- 1 # Assign double value v2 <- 1.2 # Assign character value v3 <- "Hello World!" # Assign date value v4 <- as.Date("2025-07-15") # Assign vector v5 <- c(1, 2, 3, 4, 5) # Assign calculated value v6 <- 2 + 2 # Assign using another macro variable v7 <- 2 + 2 # Calculate using another macro variable v8 <- 2 + 2 + 1 v9 <- 4 --------- ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test7.R - File Out: .//programs/test7_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ 2]: # Here is a line above [ 3][ 3]: b <- 2 [ 4][ 4]: [ 5][ ]: #%include ".//programs/test0.R" [ 6][ ]: #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# [ 7][ ]: #% Assign macro variables [ 8][ ]: #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# [ 9][ ]: #%let x = 2 [ 10][ ]: #%let y = floor(1 + 2.5) [ 11][ ]: #%let z = 3 [ 12][ ]: [ 13][ 5]: # Initial comment [ 14][ 6]: print("Starting program") [ 15][ 7]: [ 16][ ]: #%if (&x == 1) [ 17][ ]: [ 18][ ]: print("X is one") [ 19][ ]: print("another one") [ 20][ ]: [ 21][ ]: #%end [ 22][ ]: #%if (&x == 2) [ 23][ ]: [ 24][ 8]: print("X is two") [ 25][ 9]: print("another one") [ 26][ 10]: [ 27][ ]: #%end [ 28][ ]: #%if (&x. > 2) [ 29][ ]: [ 30][ ]: print("X is &x.") [ 31][ ]: print("another one") [ 32][ ]: [ 33][ ]: #%end [ 34][ ]: [ 35][ 11]: # Resolved assignment [ 36][ 12]: a <- floor(1 + 2.5) [ 37][ 13]: [ 38][ 14]: # Results [ 39][ 15]: print(paste("a is", a)) [ 40][ 16]: print("y is y.") [ 41][ 17]: print("z is z.") [ 42][ 18]: [ 43][ 19]: # Here is a line below [ 44][ 20]: c <- 3 [ 45][ 21]: [ 46][ 22]: # Fork ******************************************************************************** ** Execution ******************************************************************************** > b <- 2 > print("Starting program") [1] "Starting program" > print("X is two") [1] "X is two" > print("another one") [1] "another one" > a <- floor(1 + 2.5) > print(paste("a is", a)) [1] "a is 3" > print("y is y.") [1] "y is y." > print("z is z.") [1] "z is z." > c <- 3 ******************************************************************************** ** End ******************************************************************************** --------- fnd <- TRUE print("Found it!") v1 <- 2 v2 <- as.Date('2025-01-01') v3 <- as.POSIXct('2025-09-17 15:25:18') v4 <- as.POSIXlt('2025-09-17 15:25:18') --------- [1] "Found it!" --------- print("a is 1!") v1 <- 1 --------- [1] "a is 1!" --------- v1 <- 3 v2 <- 2 v3 <- c(1, 2, 3) v4 <- c('A', 'B', 'C') v5 <- c('A' = 1, 'B' = 2, 'C' = 3) v6 <- c('A' = 'One', 'B' = 'Two', 'C' = 'Three') --------- ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test13.R - File Out: .//programs/test13_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ ]: #%let a <- 1 [ 4][ ]: #%let aba <- 2 [ 5][ ]: [ 6][ 2]: x <- 1 [ 7][ 3]: y <- 2 [ 8][ 4]: ******************************************************************************** ** Execution ******************************************************************************** > x <- 1 > y <- 2 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test5.R - File Out: .//programs/test5_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ 2]: a <- 1 [ 3][ 3]: [ 4][ ]: #%do y = 1 %to 3 [ 5][ ]: #%let y <- 1 [ 6][ ]: [ 7][ 4]: a <- a + 1 [ 8][ 5]: print("y is 1") [ 9][ 6]: [ 10][ ]: #%let y <- 2 [ 11][ ]: [ 12][ 7]: a <- a + 1 [ 13][ 8]: print("y is 2") [ 14][ 9]: [ 15][ ]: #%let y <- 3 [ 16][ ]: [ 17][ 10]: a <- a + 1 [ 18][ 11]: print("y is 3") [ 19][ 12]: [ 20][ ]: #% end do [ 21][ 13]: b <- 3 ******************************************************************************** ** Execution ******************************************************************************** > a <- 1 > a <- a + 1 > print("y is 1") [1] "y is 1" > a <- a + 1 > print("y is 2") [1] "y is 2" > a <- a + 1 > print("y is 3") [1] "y is 3" > b <- 3 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test14.R - File Out: .//programs/test14_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ ]: #%let a <- 3 [ 4][ ]: #%let b <- "hello" [ 5][ ]: [ 6][ 2]: y <- c() [ 7][ 3]: [ 8][ ]: #%do x = 1 %to 3 [ 9][ ]: #%let x <- 1 [ 10][ 4]: print("hello") [ 11][ 5]: y <- append(y, "hello") [ 12][ ]: #%let x <- 2 [ 13][ 6]: print("hello") [ 14][ 7]: y <- append(y, "hello") [ 15][ ]: #%let x <- 3 [ 16][ 8]: print("hello") [ 17][ 9]: y <- append(y, "hello") [ 18][ ]: #% end do [ 19][ 10]: [ 20][ 11]: z <- 3 ******************************************************************************** ** Execution ******************************************************************************** > y <- c() > print("hello") [1] "hello" > y <- append(y, "hello") > print("hello") [1] "hello" > y <- append(y, "hello") > print("hello") [1] "hello" > y <- append(y, "hello") > z <- 3 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test15.R - File Out: .//programs/test15_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ ]: #%let a <- 1 [ 4][ ]: #%let b <- 3 [ 5][ ]: #%let c <- hello [ 6][ ]: [ 7][ 2]: y <- c() [ 8][ 3]: z <- c() [ 9][ 4]: [ 10][ ]: #%if (&a. == 1) [ 11][ ]: [ 12][ ]: #%do x = 1 %to 3 [ 13][ ]: #%let x <- 1 [ 14][ ]: [ 15][ ]: #%if (1 == 1) [ 16][ 5]: print("hello1") [ 17][ 6]: y <- append(y, "hello1") [ 18][ 7]: [ 19][ ]: #%else [ 20][ ]: print("&c.&x.") [ 21][ ]: z <- append(z, "&c.&x.") [ 22][ ]: #%end [ 23][ ]: [ 24][ 8]: w <- 1 [ 25][ 9]: [ 26][ ]: #%let x <- 2 [ 27][ ]: [ 28][ ]: #%if (0 == 1) [ 29][ ]: print("&c.&x.") [ 30][ ]: y <- append(y, "&c.&x.") [ 31][ ]: [ 32][ ]: #%else [ 33][ 10]: print("hello2") [ 34][ 11]: z <- append(z, "hello2") [ 35][ ]: #%end [ 36][ 12]: [ 37][ 13]: w <- 2 [ 38][ 14]: [ 39][ ]: #%let x <- 3 [ 40][ ]: [ 41][ ]: #%if (1 == 1) [ 42][ 15]: print("hello3") [ 43][ 16]: y <- append(y, "hello3") [ 44][ 17]: [ 45][ ]: #%else [ 46][ ]: print("&c.&x.") [ 47][ ]: z <- append(z, "&c.&x.") [ 48][ ]: #%end [ 49][ ]: [ 50][ 18]: w <- 3 [ 51][ 19]: [ 52][ ]: #% end do [ 53][ ]: [ 54][ ]: #%end ******************************************************************************** ** Execution ******************************************************************************** > y <- c() > z <- c() > print("hello1") [1] "hello1" > y <- append(y, "hello1") > w <- 1 > print("hello2") [1] "hello2" > z <- append(z, "hello2") > w <- 2 > print("hello3") [1] "hello3" > y <- append(y, "hello3") > w <- 3 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test16.R - File Out: .//programs/test16_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ ]: #%let a <- 2 [ 4][ ]: #%let b <- 3 [ 5][ ]: #%let c <- hello [ 6][ ]: [ 7][ 2]: w <- c() [ 8][ 3]: [ 9][ ]: #%do x = 1 %to 2 [ 10][ ]: #%let x <- 1 [ 11][ ]: [ 12][ ]: #%do y = 1 %to 3 [ 13][ ]: #%let y <- 1 [ 14][ ]: [ 15][ 4]: w <- append(w, "hello2") [ 16][ 5]: [ 17][ ]: #%let y <- 2 [ 18][ ]: [ 19][ 6]: w <- append(w, "hello3") [ 20][ 7]: [ 21][ ]: #%let y <- 3 [ 22][ ]: [ 23][ 8]: w <- append(w, "hello4") [ 24][ 9]: [ 25][ ]: #% end do [ 26][ ]: [ 27][ ]: #%let x <- 2 [ 28][ ]: [ 29][ ]: #%do y = 1 %to 3 [ 30][ ]: #%let y <- 1 [ 31][ ]: [ 32][ 10]: w <- append(w, "hello3") [ 33][ 11]: [ 34][ ]: #%let y <- 2 [ 35][ ]: [ 36][ 12]: w <- append(w, "hello4") [ 37][ 13]: [ 38][ ]: #%let y <- 3 [ 39][ ]: [ 40][ 14]: w <- append(w, "hello5") [ 41][ 15]: [ 42][ ]: #% end do [ 43][ ]: [ 44][ ]: #% end do [ 45][ ]: ******************************************************************************** ** Execution ******************************************************************************** > w <- c() > w <- append(w, "hello2") > w <- append(w, "hello3") > w <- append(w, "hello4") > w <- append(w, "hello3") > w <- append(w, "hello4") > w <- append(w, "hello5") ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test17.R - File Out: .//programs/test17_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ 2]: dat <- subset(mtcars, mpg > 20) [ 4][ 3]: [ 5][ ]: #%let x <- %symput(nrow(dat)) [ 6][ ]: SYMBOLGEN: &x = 14 [ 7][ 4]: a <- 14 [ 8][ 5]: [ 9][ 6]: dat <- subset(dat, select = c("mpg", "cyl", "disp")) [ 10][ 7]: [ 11][ ]: #%let y <- %symput(ncol(dat)) [ 12][ ]: SYMBOLGEN: &y = 3 [ 13][ 8]: b <- 3 [ 14][ 9]: [ 15][ 10]: mvar <- c("fork", "bork", "sammy") [ 16][ 11]: [ 17][ ]: #%let z <- mvar [ 18][ ]: SYMBOLGEN: &z = mvar [ 19][ 12]: c <- "mvar" [ 20][ 13]: [ 21][ ]: #%let w <- %symput(mvar) [ 22][ ]: SYMBOLGEN: &w = c('fork', 'bork', 'sammy') [ 23][ 14]: d <- c('fork', 'bork', 'sammy') ******************************************************************************** ** Execution ******************************************************************************** > dat <- subset(mtcars, mpg > 20) > a <- 14 > dat <- subset(dat, select = c("mpg", "cyl", "disp")) > b <- 3 > mvar <- c("fork", "bork", "sammy") > c <- "mvar" > d <- c("fork", "bork", "sammy") ******************************************************************************** ** End ******************************************************************************** SYMBOLGEN: &x = 1 SYMBOLGEN: &mvar1 = fork SYMBOLGEN: &x = 1 SYMBOLGEN: &mvar1 = fork SYMBOLGEN: &x = 1 SYMBOLGEN: &mvar1 = fork SYMBOLGEN: &mvar = spork SYMBOLGEN: &x = 1 SYMBOLGEN: &mvar1 = fork SYMBOLGEN: &mvar = spork ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test18.R - File Out: .//programs/test18_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ 2]: # Here is a comment [ 4][ 3]: a <- 1 [ 5][ 4]: [ 6][ ]: #% Here is a macro function [ 7][ ]: #%macro sammy(varx, vary, varz = TRUE) SYMBOLGEN: Macro 'sammy' of 6 lines stored. [ 15][ ]: [ 16][ 5]: # Here is more stuff after the macro function [ 17][ 6]: b <- 2 [ 18][ 7]: [ 19][ ]: [ 20][ ]: #% Now call the macro function SYMBOLGEN: Executing macro 'sammy'. [ 21][ ]: #%sammy(3, "fork", FALSE) [ 22][ ]: #%let varx <- 3 [ 23][ ]: #%let vary <- "fork" [ 24][ ]: #%let varz <- FALSE SYMBOLGEN: &varx = 3 [ 25][ 8]: x <- 3 [ 26][ 9]: print(x) SYMBOLGEN: &vary = "fork" [ 27][ 10]: y <- "fork" [ 28][ 11]: print(y) SYMBOLGEN: &varz = FALSE [ 29][ 12]: z <- FALSE [ 30][ 13]: print(z) SYMBOLGEN: Macro 'sammy' complete. [ 31][ ]: #%mend sammy [ 32][ 14]: [ 33][ 15]: v1 <- x [ 34][ 16]: v2 <- y [ 35][ 17]: v3 <- z [ 36][ 18]: [ 37][ 19]: # And put something after ******************************************************************************** ** Execution ******************************************************************************** > a <- 1 > b <- 2 > x <- 3 > print(x) [1] 3 > y <- "fork" > print(y) [1] "fork" > z <- FALSE > print(z) [1] FALSE > v1 <- x > v2 <- y > v3 <- z ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test19.R - File Out: .//programs/test19_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ ]: [ 3][ 2]: # Here is a comment [ 4][ ]: #%let a <- 1 SYMBOLGEN: &a = 1 [ 5][ 3]: x1 <- 1 [ 6][ 4]: print(x1) [ 7][ 5]: [ 8][ ]: [ 9][ 6]: # Here is a macro function [ 10][ ]: #%macro sammy() SYMBOLGEN: Macro 'sammy' of 3 lines stored. [ 15][ 7]: [ 16][ ]: #% Now call the macro function SYMBOLGEN: Executing macro 'sammy'. [ 17][ ]: #%sammy() [ 18][ ]: #%let a <- 2 SYMBOLGEN: &a = 2 [ 19][ 8]: x2 <- 2 [ 20][ 9]: print(x2) SYMBOLGEN: Macro 'sammy' complete. [ 21][ ]: #%mend sammy [ 22][ 10]: [ 23][ 11]: # After macro SYMBOLGEN: &a = 1 [ 24][ 12]: x3 <- 1 [ 25][ 13]: print(x3) ******************************************************************************** ** Execution ******************************************************************************** > x1 <- 1 > print(x1) [1] 1 > x2 <- 2 > print(x2) [1] 2 > x3 <- 1 > print(x3) [1] 1 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test20.R - File Out: .//programs/test20_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ 2]: # Here is a comment [ 3][ ]: #%let a <- 1 SYMBOLGEN: &a = 1 [ 4][ 3]: x1 <- 1 [ 5][ 4]: print(x1) [ 6][ 5]: [ 7][ ]: [ 8][ 6]: # Here is a macro function [ 9][ ]: #%macro sammy() SYMBOLGEN: Macro 'sammy' of 12 lines stored. [ 23][ 7]: [ 24][ ]: #% Now call the macro function SYMBOLGEN: Executing macro 'sammy'. [ 25][ ]: #%sammy() [ 26][ ]: #%let a <- 2 SYMBOLGEN: &a = 2 [ 27][ 8]: x2 <- 2 [ 28][ 9]: print(x2) [ 29][ 10]: [ 30][ ]: #%macro fork() SYMBOLGEN: Macro 'fork' of 3 lines stored. SYMBOLGEN: Executing macro 'fork'. [ 35][ ]: #%fork() [ 36][ ]: #%let a <- 3 SYMBOLGEN: &a = 3 [ 37][ 11]: x3 <- 3 [ 38][ 12]: print(x3) SYMBOLGEN: Macro 'fork' complete. [ 39][ ]: #%mend fork SYMBOLGEN: &a = 2 [ 40][ 13]: x4 <- 2 [ 41][ 14]: print(x4) SYMBOLGEN: Macro 'sammy' complete. [ 42][ ]: #%mend sammy [ 43][ 15]: [ 44][ 16]: # After macro SYMBOLGEN: &a = 1 [ 45][ 17]: x5 <- 1 [ 46][ 18]: print(x5) ******************************************************************************** ** Execution ******************************************************************************** > x1 <- 1 > print(x1) [1] 1 > x2 <- 2 > print(x2) [1] 2 > x3 <- 3 > print(x3) [1] 3 > x4 <- 2 > print(x4) [1] 2 > x5 <- 1 > print(x5) [1] 1 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test21.R - File Out: .//programs/test21_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: [ 2][ 2]: # Here is a comment [ 3][ ]: #%let a <- 1 SYMBOLGEN: Possible unresolved variable: &bork." [ 4][ 3]: x1 <- "&bork." [ 5][ 4]: [ 6][ ]: ******************************************************************************** ** Execution ******************************************************************************** > x1 <- "&bork." ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test22.R - File Out: .//programs/test22_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: # Assign regular value [ 2][ 2]: x <- 1 [ 3][ ]: #%let x1 <- %symput(x) SYMBOLGEN: &x1 = 1 [ 4][ 3]: y <- 1 [ 5][ 4]: ******************************************************************************** ** Execution ******************************************************************************** > x <- 1 > y <- 1 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test23.R - File Out: .//programs/test23_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ 1]: # Assign regular value [ 2][ 2]: x <- 1 ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test24.R - File Out: .//programs/test24_mod.R ******************************************************************************** [ In#][Out#]: SYMBOLGEN: &x = 1 [ 1][ ]: #%let y <- &x. SYMBOLGEN: &y = 1 [ 2][ 1]: z <- 1 [ 3][ 2]: print(z) ******************************************************************************** ** Execution ******************************************************************************** > z <- 1 > print(z) [1] 1 ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test26.R - File Out: D:\temp\2025_11_18_16_55_16_8593\RtmpGWH507/test26.R ******************************************************************************** [ In#][Out#]: [ 1][ ]: #%let x <- 1 [ 2][ 1]: [ 5][ ]: #%let y <- c("One", "Two", "Three") [ 6][ ]: [ 7][ 2]: # Something after [ 8][ 3]: SYMBOLGEN: &y = c("One", "Two", "Three") [ 9][ ]: #%if ("Two" %in% &y) [ 10][ ]: #%let z <- "Found it!" [ 11][ ]: #%else [ 12][ ]: #%let z <- "Sorry!" [ 13][ ]: #%end [ 14][ ]: SYMBOLGEN: &z = "Found it!" [ 15][ 4]: print("Found it!") [ 16][ 5]: [ 17][ ]: ******************************************************************************** ** Execution ******************************************************************************** > print("Found it!") [1] "Found it!" ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test27.R - File Out: .//programs/test27_mod.R ******************************************************************************** [ In#][Out#]: [ 1][ ]: #%let x <- Hello [ 2][ ]: #%let y <- {nrstr1} SYMBOLGEN: &x = Hello [ 3][ 1]: a <- "Here is Hello a regular" [ 4][ 2]: b <- "Here is &x. a protected" [ 5][ 3]: c <- "Here is &x. multiple &y. protected" SYMBOLGEN: &x = Hello [ 6][ 4]: d <- "Here is Hello mixed &x." SYMBOLGEN: &y = {nrstr1} [ 7][ 5]: e <- "Here is &x. with unresolved reference" ******************************************************************************** ** Execution ******************************************************************************** > a <- "Here is Hello a regular" > b <- "Here is &x. a protected" > c <- "Here is &x. multiple &y. protected" > d <- "Here is Hello mixed &x." > e <- "Here is &x. with unresolved reference" ******************************************************************************** ** End ******************************************************************************** ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test24.R - File Out: .//programs/test24_mod.R ******************************************************************************** [ In#][Out#]: SYMBOLGEN: &x = 1 [ 1][ ]: #%let y <- &x. SYMBOLGEN: &y = 1 [ 2][ 1]: z <- 1 [ 3][ 2]: print(z) ******************************************************************************** ** Execution ******************************************************************************** > z <- 1 > print(z) [1] 1 ******************************************************************************** ** End ******************************************************************************** Clearing macro symbol table... 2 items cleared. ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test25.R - File Out: .//programs/test25_mod.R ******************************************************************************** [ In#][Out#]: SYMBOLGEN: &x = 1 [ 1][ ]: #%let y <- &x. SYMBOLGEN: &x = 1 SYMBOLGEN: &y = 1 [ 2][ ]: #%let z <- &x. + &y. SYMBOLGEN: &z = 1 + 1 [ 3][ 1]: a <- 1 + 1 [ 4][ 2]: print(a) [ 5][ 3]: [ 6][ ]: #%macro fork(b, c = 2) SYMBOLGEN: Macro 'fork' of 2 lines stored. [ 10][ ]: [ 11][ ]: #%macro bork(b, c = 2) SYMBOLGEN: Macro 'bork' of 2 lines stored. [ 15][ ]: [ 16][ ]: #%macro sammy() SYMBOLGEN: Macro 'sammy' of 1 lines stored. [ 19][ ]: [ 20][ ]: SYMBOLGEN: Executing macro 'fork'. [ 21][ ]: #%fork(2) [ 22][ ]: #%let b <- 2 [ 23][ ]: #%let c <- 2 SYMBOLGEN: &b = 2 SYMBOLGEN: &c = 2 [ 24][ 4]: g <- 2 + 2 [ 25][ 5]: print(g) SYMBOLGEN: Macro 'fork' complete. [ 26][ ]: #%mend fork SYMBOLGEN: Executing macro 'bork'. [ 27][ ]: #%bork(4, 6) [ 28][ ]: #%let b <- 4 [ 29][ ]: #%let c <- 6 SYMBOLGEN: &b = 4 SYMBOLGEN: &c = 6 [ 30][ 6]: h <- 4 + 6 [ 31][ 7]: print(h) SYMBOLGEN: Macro 'bork' complete. [ 32][ ]: #%mend bork SYMBOLGEN: Executing macro 'sammy'. [ 33][ ]: #%sammy() [ 34][ 8]: print("Hello!") SYMBOLGEN: Macro 'sammy' complete. [ 35][ ]: #%mend sammy [ 36][ 9]: [ 37][ ]: ******************************************************************************** ** Execution ******************************************************************************** > a <- 1 + 1 > print(a) [1] 2 > g <- 2 + 2 > print(g) [1] 4 > h <- 4 + 6 > print(h) [1] 10 > print("Hello!") [1] "Hello!" ******************************************************************************** ** End ******************************************************************************** # Macro Symbol Table: 3 macro variables Name Value 1 &x 1 2 &y 1 3 &z 1 + 1 # Macro Function List: 3 functions # Function '%fork': 2 parameters - b - c = 2 # Function '%bork': 2 parameters - b - c = 2 # Function '%sammy': 0 parameters $variables $variables$`&x` [1] 1 $variables$`&y` [1] "1" $variables$`&z` [1] "1 + 1" $functions $functions$fork $functions$fork$parameters $functions$fork$parameters$b [1] "" $functions$fork$parameters$c [1] "2" $functions$fork$code [1] "g <- `&b` + `&c`" "print(g)" attr(,"start") [1] 7 attr(,"end") [1] 8 $functions$bork $functions$bork$parameters $functions$bork$parameters$b [1] "" $functions$bork$parameters$c [1] "2" $functions$bork$code [1] "h <- `&b` + `&c`" "print(h)" attr(,"start") [1] 12 attr(,"end") [1] 13 $functions$sammy $functions$sammy$parameters list() $functions$sammy$code [1] "print(\"Hello!\")" attr(,"start") [1] 17 attr(,"end") [1] 17 --------- # Here is a normal comment print("z is 6") # Comment something print("X is 3") a <- 3 print(paste("z is", 6)) print("Y is 4") b <- 4 q <- floor(2 + 2.5) d <- 6 f <- TRUE g <- FALSE --------- [1] "z is 6" [1] "X is 3" [1] "z is 6" [1] "Y is 4" --------- z <- 1 print(z) --------- [1] 1 ******************************************************************************** ** Pre-Processing ******************************************************************************** - File In: .//programs/test25.R - File Out: .//programs/test25_mod.R ******************************************************************************** [ In#][Out#]: SYMBOLGEN: &x = c(1, 2, 3) [ 1][ ]: #%let y <- &x. SYMBOLGEN: &x = c(1, 2, 3) SYMBOLGEN: &y = c(1, 2, 3) [ 2][ ]: #%let z <- &x. + &y. SYMBOLGEN: &z = c(1, 2, 3) + c(1, 2, 3) [ 3][ 1]: a <- c(1, 2, 3) + c(1, 2, 3) [ 4][ 2]: print(a) [ 5][ 3]: [ 6][ ]: #%macro fork(b, c = 2) SYMBOLGEN: Macro 'fork' of 2 lines stored. [ 10][ ]: [ 11][ ]: #%macro bork(b, c = 2) SYMBOLGEN: Macro 'bork' of 2 lines stored. [ 15][ ]: [ 16][ ]: #%macro sammy() SYMBOLGEN: Macro 'sammy' of 1 lines stored. [ 19][ ]: [ 20][ ]: SYMBOLGEN: Executing macro 'fork'. [ 21][ ]: #%fork(2) [ 22][ ]: #%let b <- 2 [ 23][ ]: #%let c <- 2 SYMBOLGEN: &b = 2 SYMBOLGEN: &c = 2 [ 24][ 4]: g <- 2 + 2 [ 25][ 5]: print(g) SYMBOLGEN: Macro 'fork' complete. [ 26][ ]: #%mend fork SYMBOLGEN: Executing macro 'bork'. [ 27][ ]: #%bork(4, 6) [ 28][ ]: #%let b <- 4 [ 29][ ]: #%let c <- 6 SYMBOLGEN: &b = 4 SYMBOLGEN: &c = 6 [ 30][ 6]: h <- 4 + 6 [ 31][ 7]: print(h) SYMBOLGEN: Macro 'bork' complete. [ 32][ ]: #%mend bork SYMBOLGEN: Executing macro 'sammy'. [ 33][ ]: #%sammy() [ 34][ 8]: print("Hello!") SYMBOLGEN: Macro 'sammy' complete. [ 35][ ]: #%mend sammy [ 36][ 9]: [ 37][ ]: ******************************************************************************** ** Execution ******************************************************************************** > a <- c(1, 2, 3) + c(1, 2, 3) > print(a) [1] 2 4 6 > g <- 2 + 2 > print(g) [1] 4 > h <- 4 + 6 > print(h) [1] 10 > print("Hello!") [1] "Hello!" ******************************************************************************** ** End ******************************************************************************** # Macro Symbol Table: 3 macro variables Name Value 1 &x 1, 2, 3 2 &y c(1, 2, 3) 3 &z c(1, 2, 3) + c(1, 2, 3) # Macro Function List: 3 functions # Function '%fork': 2 parameters - b - c = 2 # Function '%bork': 2 parameters - b - c = 2 # Function '%sammy': 0 parameters $variables $variables$`&x` [1] 1 2 3 $variables$`&y` [1] "c(1, 2, 3)" $variables$`&z` [1] "c(1, 2, 3) + c(1, 2, 3)" $functions $functions$fork $functions$fork$parameters $functions$fork$parameters$b [1] "" $functions$fork$parameters$c [1] "2" $functions$fork$code [1] "g <- `&b` + `&c`" "print(g)" attr(,"start") [1] 7 attr(,"end") [1] 8 $functions$bork $functions$bork$parameters $functions$bork$parameters$b [1] "" $functions$bork$parameters$c [1] "2" $functions$bork$code [1] "h <- `&b` + `&c`" "print(h)" attr(,"start") [1] 12 attr(,"end") [1] 13 $functions$sammy $functions$sammy$parameters list() $functions$sammy$code [1] "print(\"Hello!\")" attr(,"start") [1] 17 attr(,"end") [1] 17 SYMBOLGEN: Possible unresolved variable: &bork. SYMBOLGEN: Possible unresolved variable: &bork. SYMBOLGEN: Possible unresolved variable: &bork [ FAIL 0 | WARN 0 | SKIP 0 | PASS 271 ] > > proc.time() user system elapsed 2.59 0.67 3.21