[R] stringification magic in subset?
sundar.dorai-raj at pdf.com
Wed May 2 17:35:08 CEST 2007
ivo welch said the following on 5/2/2007 8:13 AM:
> dear R wizards:
> I am trying to replace subset() with my own version that first checks
> that each name in the select statement has a corresponding name in the
> data set. preferably, it would have the same syntax and semantics as
> subset() otherwise.
> alas, subset works in interesting ways:
> subset(d, select=col1)
> works just like
> subset(d, select="col1")
> somehow, subset manages to "stringify" its argument in such cases. Is
> it possible to duplicate the subset method one-for-one?
> a minor question---where do I find the source definition such as that
> of subset(), which is defined in
> function (x, ...)
> <environment: namespace:base>
> any help, as usual, appreciated.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
which will point you to "subset.data.frame". The latter code will answer
More information about the R-help