'Explaining a Function inside a Function in R
I got confused when I stumbled upon this code as you don't need to give "y" a value to operate, how does it get its value?
f <- function(x) {
g <- function(y) {
y + z
}
z <- 4
x + g(x)}
because if I add ran this code
z <- 10
f(3)
it will give the result (10), where the second function got its "y" value?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
