[R] First. Last. Data row selection

wookie1976 joe.roeschen at revecorp.com
Tue Feb 23 18:40:12 CET 2010

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.

More information about the R-help mailing list