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 name.
Declaration
func grouped(by columnName: String, timeUnit: Calendar.Component) -> RowGrouping<Int>Parameters
- columnName:
The name of a column.
- timeUnit:
A component of a calendar date.
Return Value
A collection of groups.
Discussion
After the method aggregates the groups, it creates a column with the same name as the original column plus the timeUnit name.