R函数中是否有"this"引用?

tOb*_*Obi 5 r

R中是否有"this"引用允许我编写

envir1 <- new.env()
assign("x", 4, envir=envir1)

test <- function(env1) {
    environment(this) <- env1
    return(x + 5)
} 

test(envir1)
Run Code Online (Sandbox Code Playgroud)

代替:

envir1 <- new.env()
assign("x", 4, envir=envir1)

test2 <- function() {
    return(x+1)
}

test <- function(env1) {
    environment(test2) <- env1
    return(test2())
}

test(envir1)
Run Code Online (Sandbox Code Playgroud)

koh*_*ske 10

怎么样

test <- function(env1) {
    with(env1, {
        return(x + 5);
        })
}
Run Code Online (Sandbox Code Playgroud)