[R] Lexical scoping is not what I expect

Hadley Wickham h.wickham at gmail.com
Thu Jun 27 17:32:08 CEST 2013


> I too find R's lexical scoping rules straightforward.
> However, I'd say that if your code relies on lexical scoping to find something, you should probably rewrite your code.

Except of course that almost every function relies on lexical scoping
to some extent!

Do you want:

f <- function(a, b) a + b

or

f <- function(a, b, plus) plus(a, b)

?

;)

Hadley


--
Chief Scientist, RStudio
http://had.co.nz/



More information about the R-help mailing list