Dear All, I am interested in using R to summarize data so that I can THEN do some additional analyses using behavioral data. I study birds, mostly, and often behavioral data that includes timing. So, for example, each line may be the occurrence of some behavior, and it would include identifiers for species, individual, date, time of observation and the various behavioral observations that may be important. Thus, if observing one individual, the difference in the time of one line to the subsequent line could be the time it took to carry out a behavior. Or, perhaps several lines include all the behaviors of a "bout" of behaviors. For example, I have a project on hummingbirds, in which an individual can be observed for a time interval, during which it may do several things. So, each "thing" becomes a line to identify what it was. Then, I would like to count behaviors from the start to the end of his "bout." Basically, I want to calculate a few things - the difference between the times of the behaviors of one line and the subsequent or some number of subsequent lines. I want to count the number of other things in a time interval, and so on. In JMP, to calculate the interval from one line to the next, I would generate a new variable, and that basically subtracts the time in line x from the time in line x+1. I can't figure out how to do that in R. Next, in JMP (or SAS), I would do a summary, in which I based it on date, species, individual, etc., and which took a Maximum and Minimum for time, the sum of say variable X, the Maximum of variable Y and so on. Example: Date Begin End Species Individual Feeding Interaction Interactsp 2008-09-11 11:15:21 11:15:58 CHAU 1 3 2008-09-11 11:16:01 11:16:12 CHAU 1 Chase CHAU 2008-09-11 11:16:17 11:16:28 CHAU 1 5 2008-09-11 11:16:32 11:16:49 CHAU 1 Flee THGL 2008-09-11 11:16:53 11:17:15 THGL 1 8 Clearly, to make another variably by just subtracting one variable from another, like time begin time end, is no problem. Also, since the species changed, the individual number can remain. What I would like to do, for example, is count the number of feedings, interactions, and so on in an interval, as well as the number of species, and calculate the total time the individual was at the food source. Well, all that is very simple in JMP and I just can't figure out how to do it in R. In fact, just figuring out how to make time and data TIME and DATE was a bit complex, but I have managed to do that. I hope I have explained my problem well enough, because all the other problems I have hinge upon summarizing my data in a way that the summary can then be used in analysis. If I could figure out this one part, I would probably switch to R completely! If you have any helpful suggestions, I am sure that there are other behavioral biologists out there that would be able to benefit from this kind of information. I know my future students will! Sincerely, Jim -- James J. Roper Smithsonian Tropical Research Institute Bocas del Toro Marine Research Station MRC 0580-03 Unit 9100, Box 0948 DPO AA 34002-9998 Skype-in (USA):+1 706 5501064 Skype-in (Brazil): 41 39415715 E-mail - personal: jjroper@gmail.com E-mail - consulting: arsartium@gmail.com 9 21.122' N, and 82 15.390' W In Google Earth, copy and paste -> 9 21.122' N, 82 15.390' W Ecologia e Conservação na UFPR http://www.bio.ufpr.br/ecologia/ Personal Pages http://jjroper.googlespages.com http://arsartium.googlepages.com [[alternative HTML version deleted]]