Dear R-list,
the following function f changes L. I thought, assignments within
functions are only local?
f<-function(LL)
{ for (ll in LL)
{ ll$txt<-"changed in f"
}
}
l<-list(txt="original value")
L<-list(l)
L[[1]]$txt
f(L)
L[[1]]$txt
gives (using R 2.3.1):
...
> L[[1]]$txt
[1] "original value"
> f(L)
> L[[1]]$txt
[1] "changed in f"
>
Thanks in advance
Andreas
______________________________________________
[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.