hi, All. Date Dtime Hour Min Second Rep App_dur 9 2006-02-22 14:36:11 14 36 11 4 1 10 2006-02-22 14:36:12 14 36 12 3 86 11 2006-02-22 14:37:38 14 37 38 0 58 14 2006-02-22 14:38:36 14 38 36 3 1 15 2006-02-22 14:38:37 14 38 37 4 1 16 2006-02-22 14:38:38 14 38 38 1 9 18 2006-02-22 14:38:47 14 38 47 0 3 20 2006-02-22 14:38:50 14 38 50 1 1 21 2006-02-22 14:38:51 14 38 51 4 2 *** 23 2006-02-22 14:38:53 14 38 53 4 39 *** 25 2006-02-22 14:39:32 14 39 32 3 1 26 2006-02-22 14:39:33 14 39 33 4 1 27 2006-02-22 14:39:34 14 39 34 3 8 28 2006-02-22 14:39:42 14 39 42 4 62
How to write a program to merge Rep with consecutive equal numbers to one of that number and sum up App_dur?? on the above data frame, i want to merge 21 2006-02-22 14:38:51 14 38 51 4 2 *** 23 2006-02-22 14:38:53 14 38 53 4 39 *** to 2006-02-22 14:38:51 14 38 51 4 41 and represent original two *** by the new one like: 9 2006-02-22 14:36:11 14 36 11 4 1 10 2006-02-22 14:36:12 14 36 12 3 86 11 2006-02-22 14:37:38 14 37 38 0 58 14 2006-02-22 14:38:36 14 38 36 3 1 15 2006-02-22 14:38:37 14 38 37 4 1 16 2006-02-22 14:38:38 14 38 38 1 9 18 2006-02-22 14:38:47 14 38 47 0 3 20 2006-02-22 14:38:50 14 38 50 1 1 2006-02-22 14:38:51 14 38 51 4 41 *** 25 2006-02-22 14:39:32 14 39 32 3 1 26 2006-02-22 14:39:33 14 39 33 4 1 27 2006-02-22 14:39:34 14 39 34 3 8 28 2006-02-22 14:39:42 14 39 42 4 62 ?? Thanks. Tammy _________________________________________________________________ Drag n dropGet easy photo sharing with Windows Live Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx [[alternative HTML version deleted]]
______________________________________________ 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.