How can I guarantee that when calling a function, it is not allowed to capture variables from the global environment?
I want the following code to give me an error. The reason is that I could be wrong z (I wanted to type y).
z <- 10 temp <- function(x,y) { y <- y + 2 return(x+z) } > temp(2,1) [1] 12
I guess the answer is related to the environments, but I haven't figured them out yet.
Is there a way to make my desired default behavior (e.g. by setting a parameter)?
source share