Created
February 21, 2024 14:49
-
-
Save randrescastaneda/34b6eeb4639fc42f2759e814f58ac0cd to your computer and use it in GitHub Desktop.
How to use with
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo <- function(x) { | |
d <- "r" | |
s <- with(x , { | |
r <- if (exists("a", inherits = FALSE)) { | |
a + b | |
} else { | |
0 | |
} | |
dd <- if (exists("d", inherits = FALSE)) { | |
1 | |
} else { | |
0 | |
} | |
list(r, dd) | |
}) | |
s | |
} | |
zz <- list(a = 1 , b = 3) | |
foo(zz) | |
goo <- \(x, ...) { | |
q <- 1 | |
r <- "H" | |
tee() | |
} | |
tee <- \() { | |
parent.frame() |> | |
as.list() | |
} | |
goo(3) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment