Dear List, I am having trouble with a tricky merging task. I have one data sheet that has dates (continuous) that radio collared individuals were monitored via telemetry. I have a different sheet containing data from instances where individuals were recaptured and associated body condition data was recorded (sheet 2). I would like to merge the two sheets by individual and date (I can do this with the merge function) but I would also like to copy the body condition data ahead and behind 15 days (or less if the individual was recorded fewer than 15 days in either direction) from the date it was recorded (this is where I'm stuck).
Thank you very much! Grant For example sheet 1 would be merged with sheet 2 to give sheet 3: Sheet 1 ind date 1 01/02/87 1 02/02/87 1 03/02/87 1 04/02/87 1 05/02/87 1 06/02/87 1 07/02/87 1 08/02/87 1 09/02/87 1 10/02/87 1 11/02/87 1 12/02/87 1 13/02/87 1 14/02/87 1 15/02/87 1 16/02/87 1 17/02/87 1 18/02/87 1 19/02/87 1 20/02/87 1 21/02/87 1 22/02/87 1 23/02/87 1 24/02/87 1 25/02/87 1 26/02/87 1 27/02/87 1 28/02/87 1 01/03/87 1 02/03/87 1 03/03/87 1 04/03/87 1 05/03/87 1 06/03/87 1 07/03/87 1 08/03/87 1 09/03/87 1 10/03/87 1 11/03/87 1 12/03/87 1 13/03/87 1 14/03/87 1 15/03/87 1 16/03/87 1 17/03/87 1 18/03/87 1 19/03/87 1 20/03/87 1 21/03/87 1 22/03/87 1 23/03/87 1 24/03/87 Sheet 2 ind BC1 BC2 1 01/02/87 33 3 1 03/03/87 44 3 Sheet 3 ind date BC1 BC2 1 01/02/87 33 3 1 02/02/87 33 3 1 03/02/87 33 3 1 04/02/87 33 3 1 05/02/87 33 3 1 06/02/87 33 3 1 07/02/87 33 3 1 08/02/87 33 3 1 09/02/87 33 3 1 10/02/87 33 3 1 11/02/87 33 3 1 12/02/87 33 3 1 13/02/87 33 3 1 14/02/87 33 3 1 15/02/87 33 3 1 16/02/87 NA NA 1 17/02/87 NA NA 1 18/02/87 44 3 1 19/02/87 44 3 1 20/02/87 44 3 1 21/02/87 44 3 1 22/02/87 44 3 1 23/02/87 44 3 1 24/02/87 44 3 1 25/02/87 44 3 1 26/02/87 44 3 1 27/02/87 44 3 1 28/02/87 44 3 1 01/03/87 44 3 1 02/03/87 44 3 1 03/03/87 44 3 1 04/03/87 44 3 1 05/03/87 44 3 1 06/03/87 44 3 1 07/03/87 44 3 1 08/03/87 44 3 1 09/03/87 44 3 1 10/03/87 44 3 1 11/03/87 44 3 1 12/03/87 44 3 1 13/03/87 44 3 1 14/03/87 44 3 1 15/03/87 44 3 1 16/03/87 44 3 1 17/03/87 44 3 1 18/03/87 44 3 1 19/03/87 44 3 1 20/03/87 44 3 1 21/03/87 NA NA 1 22/03/87 NA NA 1 23/03/87 NA NA 1 24/03/87 NA NA [[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.