Dear S-News readers,
I'm puzzling over how to solve the following problem. Let's say that I
have a data frame with possibly multiple observations (rows) per
sampling unit, in this case survey respondents. In addition to a
respondent ID variable, there is a date variable tracking the date the
information was collected. If I want to extract from this data frame
only the most recent observation (or the first, etc.) for each
respondent, how could I do this? I've been thinking about this problem
as a tapply()-like problem where the respondent ID would be the index
variable, but I haven't figured how to write a function to extract and
return entire rows. I would appreciate ideas or suggestions from fellow
list readers on how to solve this.
Thanks for your help.
-Paul
|