---
title: "grouped(by:timeUnit:)"
framework: tabulardata
role: symbol
role_heading: Instance Method
path: "tabulardata/dataframeprotocol/grouped(by:timeunit:)-78cy"
---

# grouped(by:timeUnit:)

Creates a grouping of rows that the method selects by choosing unique units of time in a date column you select by column identifier.

## Declaration

```swift
func grouped(by columnID: ColumnID<Date>, timeUnit: Calendar.Component) -> RowGrouping<Int>
```

## Parameters

- `columnID`: A column identifier.
- `timeUnit`: A component of a calendar date.

## Return Value

Return Value A collection of groups.

## Discussion

Discussion After the method aggregates the groups, it creates a column with the same name as the original column plus the timeUnit name.

## See Also

### Creating a Row Grouping by a Column

- [grouped(by:)](tabulardata/dataframeprotocol/grouped(by:)-77mq2.md)
- [grouped(by:timeUnit:)](tabulardata/dataframeprotocol/grouped(by:timeunit:)-7s782.md)
- [grouped(by:transform:)](tabulardata/dataframeprotocol/grouped(by:transform:)-3cr4p.md)
- [grouped(by:transform:)](tabulardata/dataframeprotocol/grouped(by:transform:)-3aade.md)
