These tell you the first and last row for each plate:
 
!duplicated(df$plate) 
!duplicated(df$plate, fromLast=TRUE)
 
Hope that helps.
 
Steve

>>> 

From: wookie1976 <joe.roeschen@revecorp.com>
To:<r-help@r-project.org>
Date: 24/Feb/2010 6:54 a.m.
Subject: [R] First. Last. Data row selection

I am in the process of switching from SAS over to R.  I am working on very
large CSV datasets that contain vehicle information.  As I am processing the
data, I need to select the first (or sometimes the second) record (by date)
for any records that have the same license plate number.  In SAS, there is a
function called 'first.' that can be used on sorted datasets to pull out
those first entries for each occurrence of a particular variable  (in this
case the variable is 'license plate') found in the data.  I have spent some
time looking around and cannot seem to find an equivalent function in R. 
Can anyone recommend an efficient technique that would pull this off?  I
assume the database must first be sorted by vehicle plate and date, and then
apply the filter or function.  Any help would be greatly appreciated.  

Thanks, Joe
-- 
View this message in context: http://n4.nabble.com/First-Last-Data-row-selection-tp1566260p1566260.html 
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide http://www.R ( http://www.r/ )-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

