Given a sortkey, is there a data.table shortcut to duplicate the `first` and `last` functionalities found in SAS and SPSS ?

The pedestrian approach below flags the first record of a group. 

Given the elegance of data.table (with which I'm slowly getting familiar), I'm assuming there's a shortcut using a self join & `mult`, but I'm still trying to figure it out. 

Here's the example:

```
require(data.table)

set.seed(123)
n <- 17
DT <- data.table(x=sample(letters[1:3],n,replace=T),
                 y=sample(LETTERS[1:3],n,replace=T))
sortkey  <- c("x","y")
setkeyv(DT,sortkey)
key <- paste(DT$x,DT$y,sep="-")
nw <- c( T , key[2:n]!=key[1:(n-1)] )
DT$first <- 1*nw
DT

```