Duncan Murdoch wrote:
>
> R doesn't really have global variables. <<- goes looking in parent
> environments until it finds the target variable, and makes the
> assignment there. If it never finds one, it makes the assignment in
> the "global environment", but the name is misleading: it should
> really be called the "user workspace".
>
Got it.
So, in this case:
x <- 1
f <- function() {
x <- 2
g <- function() {
x <<- 3
}
g()
x
}
f()
It's expected that f will return 3, but x would still be 1?
Alberto Monteiro
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.