Есть ли ссылка "this" в R, которая позволяет мне написать
envir1 <- new.env()
assign("x", 4, envir=envir1)
test <- function(env1) {
environment(this) <- env1
return(x + 5)
}
test(envir1)
вместо:
envir1 <- new.env()
assign("x", 4, envir=envir1)
test2 <- function() {
return(x+1)
}
test <- function(env1) {
environment(test2) <- env1
return(test2())
}
test(envir1)