> From which you might conclude that I don't like the design of subset, and > you'd be right. However, I don't think this is a counterexample to my > general rule. In the subset function, the select argument is treated as an > unevaluated expression, and then there are rules about what to do with it. > (I.e. try to look up name `a` in the data frame, if that fails, ...) > > For the requested behaviour to similarly fall within the general rule, we'd > have to treat all indices to all kinds of things (vectors, matrices, > dataframes, etc.) as unevaluated expressions, with special handling for the > particular symbol `end`.
Except you wouldn't have to necessarily change indexing - you could change seq instead. Then 5:end could produce some kind of special data structure (maybe an iterator) that was recognised by the various indexing functions. This would still be a lot of work for not a lot of payoff, but it would be a logically consistent way of adding this behaviour to indexing, and the basic work would make it possible to develop other sorts of indexing, eg df[evens(), ], or df[last(5), last(3)]. Hadley -- http://had.co.nz/ ______________________________________________ R-help@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.