[R] Variable passed to function not used in function in select=... in subset

Thomas Lumley tlumley at u.washington.edu
Tue Nov 11 20:48:04 CET 2008

Some of the uses of non-standard evaluation are undoubtedly a problem in 
R. Probably the worst is in model.frame, because it is much harder to 
work around. I have never used subset(,select=) and hence have never 
been at risk of confusion (if you don't like how it works, I suggest you 
do the same), but model.frame() is inside lots of things.

  There are two issues here that I think are worth pointing out:
1/ Some things are just not fixable any more. They can only be fixed in a 
new language. The people thinking about new statistical languages mostly 
know what the problems are, because they have been using S and/or R for 
many years and it's really not that hard to notice the problems. The 
document on non-standard evaluation demonstrates that R-core is aware of 
this particular problem.

2/ There are some uses of non-standard evaluation that don't seem to 
confuse people, and an interesting question is how to characterise them. 
These are what I referred to as 'macro-like functions' in the document 
that you have already been referred to.  For example, subset(,subset=) and 
with() don't seem to be as confusing or to cause problems for programmers 
in the same way. There is an empirical question as to what these 
relatively non-problematic constructs are, and a theoretical question as 
to why they are different. In particular, with() not only has non-standard 
evaluation, it is quite similar to the notoriously confusing attach().


On Tue, 11 Nov 2008, Wacek Kusnierczyk wrote:

> Berwin A Turlach wrote:
>> On Tue, 11 Nov 2008 09:27:41 +0100
>> Wacek Kusnierczyk <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:
>>> but then it might be worth asking whether carrying on with misdesign
>>> for backward compatibility outbalances guaranteed crashes in future
>>> users' programs, [...]
>> Why is it worth asking this if nobody else asks it?
> i guess most of the people who do ask questions here care little about r
> itself, they just want it to solve a problem, even if it involves
> hacking the language.
> those outside the r team who care about language design have probably
> left the list long ago, if only they were subscribed.  the fact that
> it's only me asking is no statistics.  i do talk to people, and know
> many who'd ask, but they just don't care, because they have already
> trashed r.  instead of discouraging me, make use of that i care to ask.
> vQ
> ______________________________________________
> 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.

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

More information about the R-help mailing list