Define group as a function (optional)
If supplied group is a function, it is evaluated through the current dimension.