Actually, the way you did is wrong. You ignore an instruction that "the year_1 and year_2 are recorded so that a plant is alive if the year of a question is equal to or grater than the year_1 and equal to and less than the year_2." That is, you can't ignore the ages between year_1 and year_2.
The below table is to help you understand what this problem suggests. Anyways thanks. -- View this message in context: http://n4.nabble.com/Average-of-a-variable-against-another-tp1477981p1478055.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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.