Kenn Konstabel wrote:
>
> If you really hate <-, you should do either
> foo({(x=42)})   # or ....
> foo({x=42; x})  # or even ...
> foo(a=force(x=43))
>   


if you think the use of force guarantees that x is assigned 43, you're
wrong.

foo = function(a) 0
x = 1
foo(a=force(x=2))
x

foo = function(a) deparse(substitute(a))
x = 1
foo(a=force(x=2))
x

in both cases, the result (the final value of x, but not the value
returned by foo in the second example) does not change when you replace
'force(x=2)' with 'x<-2'.

vQ

______________________________________________
R-help@r-project.org 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.

Reply via email to