[R] Variable passed to function not used in function in select=... in subset
Gavin Simpson
gavin.simpson at ucl.ac.uk
Tue Nov 11 16:59:54 CET 2008
On Tue, 2008-11-11 at 08:14 -0600, hadley wickham wrote:
> > And without wanting to be rude or anything, your opinion carries very
> > little weight in a project like R. You've arrived on the list and been
> > very critical of the work of others. Now there is nothing wrong with
> > being critical if it is constructive, and additionally with something
> > like R you need to be constructive *and* contribute back. I'm not saying
>
> You are holding Wacek to a very high standard. Why is not acceptable
> to say that this part of R is hard to understand without having to
> provide a better solution?
Ok, reading back I should have said if you want something fixed, patches
are welcome. I didn't mean to say that to get help you had to contribute
back. However, Wacek's approach was (and I'm paraphrasing): subset
doesn't work logically or as I expect. It is a mess and needs fixing.
I'm sure no-one on the list minds if people don't understand things and
want to ask questions - I know I ask plenty of questions here about
things I don't understand. But just as there is a posting guide that
says how to go about phrasing a question that is likely to get a
response, we don't need people denigrating the work of others whilst
asking for assistance with what are admittedly hard concepts (ones I
don't fully understand either).
I've found several of these discussions involving Wacek's questions very
enlightening at times; once you get past the "it doesn't work as I
expect so is wrong" attitude.
>
> subset() _is_ confusing to novice R users. You can not anticipate
> what subset(df, select = a) will do unless you know what variables are
> defined in the local environment and what variables are defined in the
> data frame. It is hard to understand how it works without a deep
> understanding of environments and it is hard to teach all the special
> cases. It is difficult to reliably use subset within another
> function.
I agree, but one can read the documentation for help. It isn't perfect
and expects you know a bit (a lot) about environments etc, but I don't
think it is too confusing if you know what is in df (otherwise how do
you know what to select?), you read the help page and follow the
examples.
G
>
> This comes from my personal experience with subset (good for
> interactive use, never program with) and from my experiences teaching
> ~80 students how to use R over the last two years.
>
> Hadley
>
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list