[R] Average of a variable against another.
Dear helpers, FYI, I am a beginner of R, just have dealt with MATLAB or JAVA. I want to know how to solve one problem given 4 variables: year_1, year_2, tall_1, tall_2. The tall_1 is measured at year_1 and tall_2 at year_2. The tall has grown up such as uniformly 1 cm/yr. The data is like year_1 year_2 tall_1 tall_2 200720101215 19992009616 200320051113 20022009310 ..... ..... ..... ..... So I need to get the average tall of the plant against year, for all the years of available data. 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. For example, 1999200020012002200320042005200620072008 20092010 6 7 8 9101112 1314 15 16 3 4 5 6 7 89 10 111213 12 13 1415 avg 678 6 25/3 ...etc. Since the amount of the data is too huge, I need to use appropriate functions and algorithm but I am not good at programming R. I wish you help me out from this hell problem please. Thanks, K -- View this message in context: http://n4.nabble.com/Average-of-a-variable-against-another-tp1477981p1477981.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.
Re: [R] Average of a variable against another.
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.
Re: [R] Average of a variable against another.
Take it easy. I wrote that thank you. Actually, the sentences "Get the average tall of the plant against year, for all the years of available data. 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. " is just copied from the problem and that's all. As well, the table I meant is just below 1999200020012002200320042005200620072008 20092010 6 7 8 9101112 1314 15 16 3 4 5 6 7 89 10 111213 12 13 1415 avg 6 7 8 6 25/3 ...etc. Nevertheless, I am sorry if you couldn't understand what it means. -- View this message in context: http://n4.nabble.com/Average-of-a-variable-against-another-tp1477981p1478122.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.