# Aggregation

*Aggregation* is a data analysis operation which combines the data of similar observations.

## Example

The table below shows data for three observations.

Person | Gender | Height |
---|---|---|

Bob | Male | 6 feet |

Carmen | Female | 5 feet |

Fred | Male | 6 feet |

The table below has been created from the table above by aggregating by gender. It can be thought of as either a summary of the table above, or, a new data set with a new definition of the observation (i.e., gender rather than person). In this example, the mathematical function that has been used to aggregate the numeric data is the mean. However, other functions are appropriate (e.g., maximum, sum).

Gender | Average Height |
---|---|

Male | 6 feet |

Female | 5 feet |

## Related R functions

`aggregate`