[R] The end of Matlab

hadley wickham h.wickham at gmail.com
Fri Dec 12 20:01:38 CET 2008


> My end would be the output of your end().  If there are no args and no local
> context, I don't see the need for it to be a function call.  It would just
> be defined as something like
>
> end <- structure( function(n) c(rep(FALSE, n-1), TRUE), class="selector")

Oh, I see what you mean.

> I'm not sure what the definition of : should be if one of the args is a
> selector.

Alternatively you could use !first(2), and only use end/last when you
want to select the last n observations.  Of course !first(2) would be
the equivalent to -(1:2) so there's not much savings there.

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list