Skip to content
Prev 70310 / 398506 Next

obtaining first and last record for rows with same identifier

I think by() is simpler:

 by(yourframe,factor(yourframe$patid),function(x)x[c(1,nrow(x)),])



-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box