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

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
e attached are in no way my original work. Benjamin -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of wookie1976 Sent: Tuesday, February 23, 2010 12:40 PM To: r-help@r-project.org Subject: [R] First. Last. Data row selection I

[R] First. Last. Data row selection

2010-02-23 Thread wookie1976
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, ther