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 <joe.roesc...@revecorp.com>
To:<r-help@r-project.org>
Date: 24/Feb/2010 2:53 p.m.
Subject: Re: [R] First. Last. Data row selection

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 done, I can selectively either keep or
drop rows based on whether they are true or false.  I have tried to get this
done with several variable creation statements with no luck.  Any ideas on
how I can modify your code to get the following:

Plate, Date, True.False
Plate1, 013110, true
Plate 1, 010110, false
Plate 1, 010109, false
Plate 2, 020110, true

To everyone else, thanks greatly for your examples!  I have learned from
each of your suggestions.

-- 
View this message in context: 
http://n4.nabble.com/First-Last-Data-row-selection-tp1566260p1566801.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]]

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

Reply via email to