<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TabularData",
  "identifier" : "/documentation/TabularData/RowGroupingProtocol/aggregated(on:naming:transform:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TabularData"
    ],
    "preciseIdentifier" : "s:11TabularData19RowGroupingProtocolP10aggregated2on6naming9transformAA0B5FrameVSaySSG_S2SXEqd_0_SgAA24DiscontiguousColumnSliceVyqd__GKXEtKr0_lF"
  },
  "title" : "aggregated(on:naming:transform:)"
}
-->

# aggregated(on:naming:transform:)

Generates a data frame by aggregating each group’s contents for each column you select by name.

```
func aggregated<Element, Result>(on columnNames: [String], naming: (String) -> String, transform: (DiscontiguousColumnSlice<Element>) throws -> Result?) rethrows -> DataFrame
```

## Parameters

`columnNames`

A comma-separated, or variadic, list of column names.

`naming`

A closure that converts a column name to another name.

`transform`

A closure that aggregates a group’s elements in a specific column.

## Discussion

The data frame contains two columns that:

- Identify each group
- Store the results of your aggregation transform closure

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)