Re: [R] is it safe to replace every "<-" by "=" in R code?

From: Peter Danenberg <danenberg_at_post.harvard.edu>
Date: Mon, 14 Jan 2008 01:31:52 -0600

Quoth Mark Wardle on Prickle-Prickle, Chaos 14, 3174:
> I can see that f(b <- 10) is equivalent to f(assign("b"), 10))

f(assign("b", 10))?

My undestanding is that assign applies to the parental environment; but the return value of assign, namely 10, is passed to f as the local variable a.

The default value b = 4 then overrides the parental environment since it is unspecified in the call to f.



R-help_at_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. Received on Mon 14 Jan 2008 - 07:42:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Jan 2008 - 08:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive