[R] Splitting Data by Row
Ross Culloch
ross.culloch at dur.ac.uk
Fri Jun 19 16:38:48 CEST 2009
Hello fellow R users!
I wonder if someone can help with what i think should be a simple question
but i can't seem to find the answer or work it out.
My data set is as such:
Day Time ID Behaviour
1 9 A1 2
1 10 A2 3
.. .. .. ..
4 10 A1 10
4 11 A2 1
.. .. .. ..
30 1 B1 14
30 2 C3 4
So basically i have data for several days, for several times, for several
IDs and for several Behaviours
What i want to do is get an activity budget for ID from these data, e.g:
data <- tapply(Behaviour,list(ID,Behaviour),length)
This will give me a count of the number of times an ID does a certain
behaviour for all the data, which is great - but i want to work out seasonal
and diurnal activity budgets too, therefore i need to break the data down
not just by ID but by day and time, too - I've searched on here and found
nothing i could adapt to my data - it may be that i can't see quite how the
code would work and i've overlooked something of importance!
If anyone can point me in the right direction i'd be most grateful!
Cheers,
Ross
--
View this message in context: http://www.nabble.com/Splitting-Data-by-Row-tp24112822p24112822.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list