---
title: "group(columnsNamed:aggregators:)"
framework: createml
role: symbol
role_heading: Instance Method
path: "createml/mldatatable/group(columnsnamed:aggregators:)"
---

# group(columnsNamed:aggregators:)

Creates a new data table with the given columns and adds a new column for each of the given aggregators.

## Declaration

```swift
func group<S>(columnsNamed: String..., aggregators: S) -> MLDataTable where S : Sequence, S.Element == MLDataTable.Aggregator
```

## Parameters

- `columnsNamed`: The name of the columns to include in the new data table.
- `aggregators`: A sequence of aggregators, each of which adds a column in the new data table.

## Return Value

Return Value A new data table.

## See Also

### Aggregating rows

- [MLDataTable.Aggregator](createml/mldatatable/aggregator.md)
