[R] length of object in repeated measures

clion birte_2 at hotmail.com
Mon Feb 9 13:36:10 CET 2009


Hi there.
I collectad data of several animals (Id) that were caught and measured at
several occasions.
The dataframe looks like this:
Grouped Data: mass ~ age | Id
Id      age       mass
1        1           5.4
1        3           6.2
1       15         10.0
2        3           8.1
2       10         12.8
3        2           5.9
3       10          7.1
3       15         15.4
3       17         16.2

Now, I would like to add a column that shows the number of captures per
Animal (so it'll look like this:) 
Id  ....   NoCaps
1   ....     3
1   ....     3
1   ....     3
2   ....     2
2   ....     2
3   ....     4  
3   ....     4
....
 
I understand that with 
tapply(Id,Id, length)
I can find out how many times each animal was caught, but how do I get this
information into an extra column? I'm sure, this is an easy question, but
I'm lost, where to find the answer, or especially where to look it up. if
this is not a new question, please give me the key words to look for it...

thanks in advance






-- 
View this message in context: http://www.nabble.com/length-of-object-in-repeated-measures-tp21911978p21911978.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list