[R] Is = now the same as <- in assigning values
Wacek Kusnierczyk
Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Thu Dec 18 19:58:19 CET 2008
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
More information about the R-help
mailing list