R provides a wide array of functions to aid in aggregating data. For simple tabulation and cross-tabulation, the table function is available. For more complex tasks, the available functions can be broken down into two groups: those that are designed to work effectively with arrays and/or lists, like apply, sweep, mapply, sapply, and lapply, and those that are oriented toward data frames (like aggregate and by). There is considerable overlap between the two tools, and the output of one can be converted to the equivalent of the output from another, so often the choice of an appropriate function is a matter of personal taste.
We'll start by looking at the table function, and then study the other functions which can be used to aggregate data from various sources.
KeywordsData Aggregation Data Frame Table Function Split Function Single Vector
Unable to display preview. Download preview PDF.