[R] Advanced Filtering problem

From: T.D.Rudolph <prairie.picker_at_gmail.com>
Date: Thu, 19 Jun 2008 14:06:11 -0700 (PDT)

http://www.nabble.com/file/p18018170/subdata.csv subdata.csv

I've attached 100 rows of a data frame I am working with. I have one factor, id, with 27 levels. There are two columns of reference data, x and y (UTM coordinates), one column "date" in POSIXct format, and one column "diff" in times format (chron package).

What I am trying to do is as follows:
For each day of the year (date, irrespective of time), select that row for each id which contains the smallest "diff" value, resulting in an output containing in general one value per id per day.

"aggregate" has been suggested but it only produces the columns considered in the function and I need all columns intact. My data frame contains almost 70,000 entries so manual sorting is not an option. I know R is robust but my programming skills are elementary. The only way I know to approach it is to first separate every id, then filter, then recombine somehow. Is there not a more efficient way for this relatively straight-forward filtering exercise?


View this message in context: http://www.nabble.com/Advanced-Filtering-problem-tp18018170p18018170.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 19 Jun 2008 - 22:33:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 20 Jun 2008 - 02:32:00 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive