arrange and group_by working together. closes #491