5
是否有R A “this” 引用,让我来写,而不是R函数中是否有“this”引用?
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)
没有必要,以结束与每个语句分号。这是R,而不是C;) – 2011-05-12 15:01:01
好吧,你是正确的.. thx ^^ – tObi 2011-05-12 15:12:03
@Joris - 现在修正:-) – 2011-05-12 16:03:11