I'm trying to figure out a way of grouping data from simple tally data. For example, I would like to turn the following table into the table at the bottom. I would normally do this in sql statements, but I won't have control over the data, so that's not an option... Thanks, Jeff. dbh, tally 5 1 12 2 6 1 10 1 6 1 12 1 10 2 9 1 3 1 5 1 8 1 3 1 6 1 5 1 10 1 5 1 4 1 22 1 20 1 15 1 14 1 11 1 15 1 10 1 8 1 14 1 10 1 11 1 16 1 17 1 10 1 12 1 9 1 6 1 11 1 18 1 7 1 8 1 9 1 12 1 13 1 14 1 16 1 15 1 8 1 35 1 5 1 8 1 14 1 11 1 12 1 20 1 10 1 27 1 7 1 8 2 12 2 5 1 20 1 12 1 17 1 22 1 10 1 13 1 9 1 27 1 9 1 18 1 12 1 15 2 18 1 22 1 16 1 17 1 11 1 15 1 8 1 14 1 18 1 11 1 14 1 9 1 14 1 8 1 9 1 10 1 20 1 11 1 10 1 6 1 10 1 16 1 8 2 14 2 7 1 5 1 8 1 15 1 13 2 13 1 15 1 9 2 16 1 18 1 12 1 10 1 17 1 15 1 7 1 17 1 20 1 5 1 7 1 6 1 7 1 4 1 8 1 7 1 4 1 16 1 6 1 5 1 3 1 5 1 17 1 6 1 13 1 10 1 6 1 7 1 9 1 5 1 6 1 9 1 22 1 2 1 8 1 5 1 14 1 12 1 14 1 9 2 19 1 18 1 17 1 23 1 21 1 22 1 16 1 15 1 13 1 9 1 14 1 11 1 19 1 19 1 20 1 25 1 22 1 22 1 17 1 24 1 15 1 8 1 3 1 6 1 7 1 11 1 11 1 11 1 5 1 19 1 16 1 12 1 9 1 16 1 13 1 12 1 18 1 18 1 19 1 11 1 12 1 11 1 13 1 13 1 12 1 10 1 15 1 6 1 11 1 9 1 8 1 7 1 12 1 15 1 15 1 12 1 17 1 17 1 20 1 9 1 8 1 16 1 19 1 25 1 22 1 23 1 21 1 23 1 19 1 8 1 16 1 10 1 16 1 11 1 11 1 10 1 13 1 17 1 15 1 6 1 23 1 21 1 12 1 14 1 17 1 17 1 12 1 12 1 14 1 17 1 17 1 11 1 13 1 19 1 27 1 10 1 33 1 9 1 10 1 15 1 12 1 11 1 8 1 8 1 10 1 7 1 10 1 12 1 9 1 12 1 7 1 10 1 9 1 11 1 12 1 10 1 10 1 11 1 16 1 13 1 8 1 17 1 15 1 19 1 16 1 12 1 7 1 11 1 15 1 15 1 14 1 14 1 8 1 6 1 7 1 23 1 4 1 4 1 7 1 6 1 9 1 10 1 15 1 23 1 8 1 13 1 8 1 21 1 24 1 22 1 8 1 14 1 24 1 13 1 17 1 9 1 25 1 9 1 22 1 7 1 20 1 13 2 15 1 9 1 17 1 13 1 18 1 9 1 19 1 7 1 14 1 15 1 9 1 16 1 12 1 7 1 9 1 11 1 23 1 8 1 19 1 10 1 23 1 6 1 28 1 32 1 9 1 6 1 27 1 14 1 18 1 11 1 14 1 10 1 15 1 9 1 21 1 23 1 16 2 19 1 22 1 16 1 13 1 11 1 29 1 "dbh","SumOftally" 2,1.00 3,4.00 4,5.00 5,13.00 6,17.00 7,18.00 8,26.00 9,29.00 10,27.00 11,24.00 12,27.00 13,19.00 14,20.00 15,23.00 16,18.00 17,18.00 18,10.00 19,12.00 20,8.00 21,5.00 22,11.00 23,9.00 24,3.00 25,3.00 27,4.00 28,1.00 29,1.00 32,1.00 33,1.00 35,1.00
Have you considered "aggregate"? hth. spencer graves Jeff D. Hamann wrote:> I'm trying to figure out a way of grouping data from simple tally data. For > example, I would like to turn the following table into the table at the > bottom. I would normally do this in sql statements, but I won't have control > over the data, so that's not an option... > > Thanks, > Jeff. > > dbh, tally > 5 1 > 12 2 > 6 1 > 10 1 > 6 1 > 12 1 > 10 2 > 9 1 > 3 1 > 5 1 > 8 1 > 3 1 > 6 1 > 5 1 > 10 1 > 5 1 > 4 1 > 22 1 > 20 1 > 15 1 > 14 1 > 11 1 > 15 1 > 10 1 > 8 1 > 14 1 > 10 1 > 11 1 > 16 1 > 17 1 > 10 1 > 12 1 > 9 1 > 6 1 > 11 1 > 18 1 > 7 1 > 8 1 > 9 1 > 12 1 > 13 1 > 14 1 > 16 1 > 15 1 > 8 1 > 35 1 > 5 1 > 8 1 > 14 1 > 11 1 > 12 1 > 20 1 > 10 1 > 27 1 > 7 1 > 8 2 > 12 2 > 5 1 > 20 1 > 12 1 > 17 1 > 22 1 > 10 1 > 13 1 > 9 1 > 27 1 > 9 1 > 18 1 > 12 1 > 15 2 > 18 1 > 22 1 > 16 1 > 17 1 > 11 1 > 15 1 > 8 1 > 14 1 > 18 1 > 11 1 > 14 1 > 9 1 > 14 1 > 8 1 > 9 1 > 10 1 > 20 1 > 11 1 > 10 1 > 6 1 > 10 1 > 16 1 > 8 2 > 14 2 > 7 1 > 5 1 > 8 1 > 15 1 > 13 2 > 13 1 > 15 1 > 9 2 > 16 1 > 18 1 > 12 1 > 10 1 > 17 1 > 15 1 > 7 1 > 17 1 > 20 1 > 5 1 > 7 1 > 6 1 > 7 1 > 4 1 > 8 1 > 7 1 > 4 1 > 16 1 > 6 1 > 5 1 > 3 1 > 5 1 > 17 1 > 6 1 > 13 1 > 10 1 > 6 1 > 7 1 > 9 1 > 5 1 > 6 1 > 9 1 > 22 1 > 2 1 > 8 1 > 5 1 > 14 1 > 12 1 > 14 1 > 9 2 > 19 1 > 18 1 > 17 1 > 23 1 > 21 1 > 22 1 > 16 1 > 15 1 > 13 1 > 9 1 > 14 1 > 11 1 > 19 1 > 19 1 > 20 1 > 25 1 > 22 1 > 22 1 > 17 1 > 24 1 > 15 1 > 8 1 > 3 1 > 6 1 > 7 1 > 11 1 > 11 1 > 11 1 > 5 1 > 19 1 > 16 1 > 12 1 > 9 1 > 16 1 > 13 1 > 12 1 > 18 1 > 18 1 > 19 1 > 11 1 > 12 1 > 11 1 > 13 1 > 13 1 > 12 1 > 10 1 > 15 1 > 6 1 > 11 1 > 9 1 > 8 1 > 7 1 > 12 1 > 15 1 > 15 1 > 12 1 > 17 1 > 17 1 > 20 1 > 9 1 > 8 1 > 16 1 > 19 1 > 25 1 > 22 1 > 23 1 > 21 1 > 23 1 > 19 1 > 8 1 > 16 1 > 10 1 > 16 1 > 11 1 > 11 1 > 10 1 > 13 1 > 17 1 > 15 1 > 6 1 > 23 1 > 21 1 > 12 1 > 14 1 > 17 1 > 17 1 > 12 1 > 12 1 > 14 1 > 17 1 > 17 1 > 11 1 > 13 1 > 19 1 > 27 1 > 10 1 > 33 1 > 9 1 > 10 1 > 15 1 > 12 1 > 11 1 > 8 1 > 8 1 > 10 1 > 7 1 > 10 1 > 12 1 > 9 1 > 12 1 > 7 1 > 10 1 > 9 1 > 11 1 > 12 1 > 10 1 > 10 1 > 11 1 > 16 1 > 13 1 > 8 1 > 17 1 > 15 1 > 19 1 > 16 1 > 12 1 > 7 1 > 11 1 > 15 1 > 15 1 > 14 1 > 14 1 > 8 1 > 6 1 > 7 1 > 23 1 > 4 1 > 4 1 > 7 1 > 6 1 > 9 1 > 10 1 > 15 1 > 23 1 > 8 1 > 13 1 > 8 1 > 21 1 > 24 1 > 22 1 > 8 1 > 14 1 > 24 1 > 13 1 > 17 1 > 9 1 > 25 1 > 9 1 > 22 1 > 7 1 > 20 1 > 13 2 > 15 1 > 9 1 > 17 1 > 13 1 > 18 1 > 9 1 > 19 1 > 7 1 > 14 1 > 15 1 > 9 1 > 16 1 > 12 1 > 7 1 > 9 1 > 11 1 > 23 1 > 8 1 > 19 1 > 10 1 > 23 1 > 6 1 > 28 1 > 32 1 > 9 1 > 6 1 > 27 1 > 14 1 > 18 1 > 11 1 > 14 1 > 10 1 > 15 1 > 9 1 > 21 1 > 23 1 > 16 2 > 19 1 > 22 1 > 16 1 > 13 1 > 11 1 > 29 1 > > > "dbh","SumOftally" > 2,1.00 > 3,4.00 > 4,5.00 > 5,13.00 > 6,17.00 > 7,18.00 > 8,26.00 > 9,29.00 > 10,27.00 > 11,24.00 > 12,27.00 > 13,19.00 > 14,20.00 > 15,23.00 > 16,18.00 > 17,18.00 > 18,10.00 > 19,12.00 > 20,8.00 > 21,5.00 > 22,11.00 > 23,9.00 > 24,3.00 > 25,3.00 > 27,4.00 > 28,1.00 > 29,1.00 > 32,1.00 > 33,1.00 > 35,1.00 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help