[R] Identifying last record in individual growth data over different time intervalls
Rainer M. Krug
Rainer.Krug at uct.ac.za
Tue Mar 6 07:52:04 CET 2007
Hi
jim holtman wrote:
> What is wrong with the method that you have? It looks reasonable
Actually there is nothing wrong with the approach I am using - it just
seemed to be quite complicated and I assumed that there is an easier
approach around.
The dataset is not that large that I really have to worry about efficiency.
Thanks a lot ,
Rainer
> efficient. As with other languages, there are always other ways of doing
> it. Here is another to consider, but it is basically the same:
>
>> sapply(split(t, t$plate), function(x) x$id[which.max(x$year)])
> 15 20 33 43 44 47 64 D72 S200
> S201 S202 S203 S204
> 2006001 2006003 2006005 2006007 2006008 2006009 2006014 2006015 2006016
> 2006017 2004095 2006019 2006020
> S205 S206 S207 S208 S209 S210 S211 S212 S213
> S214 S215 S216 S217
> 2006021 2006022 2006023 2006024 2006025 2006026 2006027 2006028 2006029
> 2006030 2006031 2006032 2006033
> S218 S219 S220 S222 S223 S224
> 2006034 2006035 2006036 2006037 2006038 2006039
>
>
>
> On 3/5/07, Rainer M. Krug <Rainer.Krug at uct.ac.za> wrote:
>> Hi
>>
>> I have a plist t which contains size measurements of individual plants,
>> identified by the field "plate". It contains, among other, a field
>> "year" indicating the year in which the individual was measured and the
>> "height". The number of measurements range from 1 to 4 measurements in
>> different years.
>> My problem is that I would need the LAST measurement. I only came up
>> with the solution below which is probably way to complicated, but I
>> can't think of another solution.
>>
>> Does anybody has an idea how to do this more effectively?
>>
>> Finally I would like to have a data.frame t2 which only contains the
>> entries of the last measurements.
>>
>> Thanks in advance,
>>
>> Rainer
--
NEW EMAIL ADDRESS AND ADDRESS:
Rainer.Krug at uct.ac.za
RKrug at sun.ac.za WILL BE DISCONTINUED END OF MARCH
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)
Leslie Hill Institute for Plant Conservation
University of Cape Town
Rondebosch 7701
South Africa
Fax: +27 - (0)86 516 2782
Fax: +27 - (0)21 650 2440 (w)
Cell: +27 - (0)83 9479 042
Skype: RMkrug
email: Rainer.Krug at uct.ac.za
Rainer at krugs.de
More information about the R-help
mailing list