On 29-08-2013, at 20:15, srecko joksimovic <sreckojoksimo...@gmail.com> wrote:
> Thanks Arun, > > this is great. However, it should be just a little bit different: > > # id event time time_on_task > #1 1 add 1373502892 80 > #2 2 add 1373502972 23 > #3 3 delete 1373502995 901 > #4 4 view 1373503896 100 > #5 5 add 1373503996 NA > > When I calculate difference, I need to know how long each activity was. It > is id2-id1 for the first activity... then why don't you try dat1$time_on_task<- c(diff(dat1$time),NA) Berend ______________________________________________ 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.