> > ...
> > # I've found I need to lag a column to mimic SAS' first.
> > # operator, thusly, though perhaps someone else knows
> > # differently.  Note this does not work on unordered
> > # dataframes!
> > lag.k1 <- c(NA, tt$k1[1:(nrow(tt) - 1)])
> > tt$r.first.k1 <- ifelse(is.na(lag.k1), 1, tt$k1 != lag.k1)
> >
> > lag.k2 <- c(NA, tt$k2[1:(nrow(tt) - 1)])
> > tt$r.first.k2 <- ifelse(is.na(lag.k2), 1, tt$k2 != lag.k2)
> > 
> It depends on how you use duplicated()
> 
> all.equal( tt$sas.first.k2, 0+!duplicated( tt[, c("k1","k2") ] ) )
> [1] TRUE

Wonderful.  Concise.  Good job.

cur
-- 
Curt Seeliger, Data Ranger
Raytheon Information Services - Contractor to ORD
seeliger.curt@epa.gov
541/754-4638


	[[alternative HTML version deleted]]

