Aggregating rows to create a new data frame

So glad it helped! Just for fun, there is a package called santoku that has a lot of the same functionality as cut(), but with some nice extra features. Check it out if you need to do a lot of this kind of data manipulation.

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: