Hello- Upon searching the email archives and reading documentation I haven't found what I'm looking for. I have a dataset with a time/date stamp on a series of geographic locations (lat/lon) associated with the movements of animals. On some days there are numerous locations and some days there is only one location. Associated with each location is an indication that the quality of the location is either "good", "poor", or "unknown". For each animal, I want to extract only one location for each day. And I want the location extracted to be nearest to 12pm on any given day, and highest quality possible.
So the order of priority for my extraction will be: 1. only one location per animal each day; 2. the location selected be as close to 12pm as possible; 3. the selected location comes from the best locations available (ie. take from pool of "good" locations first, or select from "poor" locations if a "good" location isn't available, or "unknown" if nothing else is available). I think aspect of this task that has me particularly stumped is how to select only one location for each day, and for that location to be a close to 12pm as possible. An example of my dataset follows: DeployID Date.Time LocationQuality Latitude Longitude STM05-1 28/02/2005 17:35 Good -35.562 177.158 STM05-1 28/02/2005 19:44 Good -35.487 177.129 STM05-1 28/02/2005 23:01 Unknown -35.399 177.064 STM05-1 01/03/2005 07:28 Unknown -34.978 177.268 STM05-1 01/03/2005 18:06 Poor -34.799 177.027 STM05-1 01/03/2005 18:47 Poor -34.85 177.059 STM05-2 28/02/2005 12:49 Good -35.928 177.328 STM05-2 28/02/2005 21:23 Poor -35.926 177.314 Many thanks for your input. I'm using R 2.5.1 on Windows XP. Cheers, Tim Sippel (MSc) School of Biological Sciences Auckland University Private Bag 92019 Auckland 1020 New Zealand +64-9-373-7599 ext. 84589 (work) +64-9-373-7668 (Fax) +64-21-593-001 (mobile) [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch 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.