Re: [R] First. Last. Data row selection

2010-02-23 Thread Steve Taylor
Ah, those can be used to index the rows: # create a new column with TRUE for the first row of each Vin: ladata2$First <- !duplicated(ladata2$Vin) # view only those rows: ladata2[ladata2$First,] >>> From: wookie1976 To: Date: 24/Feb/2010 2:53 p.m. Subject: Re: [R] First. La

Re: [R] First. Last. Data row selection

2010-02-23 Thread wookie1976
Steve, Your example seems to work quite well, except I get a summary printout showing all the true and false values. > !duplicated(ladata2$Vin) [1] TRUE TRUE TRUE TRUE What I would like to do is have the true/false values appended to a column at the end of my dataset so that when don

Re: [R] First. Last. Data row selection

2010-02-23 Thread Steve Taylor
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 To: 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.

Re: [R] First. Last. Data row selection

2010-02-23 Thread Sharpie
wookie1976 wrote: > > 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 licen

Re: [R] First. Last. Data row selection

2010-02-23 Thread Nutter, Benjamin
I've attached some functions I've written based on previous questions that have been posted here. Unfortunately, I was too lazy to give credit to previous commenters in my Rd file, and for that I hope they'll forgive me. In any case, please be assured that the functions I've attached are in no