I need to gather
a dataframe, however the columns have further groupins. Example:
I know how to use gather
when I have just the columns.
But I would also like to have the groups, like this:
In such way I would be able to group this data as I want later. How can I do this?
group1 group1 group2 group2 group2
Week Region 1 2 3 4 5
201601 somehing 0 0 0 0 0
201602 somehing 0 0 0 0 0
201603 somehing 0 0 0 0 0
201604 somehing 0 0 79.03055276 0 20675
201605 somehing 0 0 68.2845204 0 955157
201606 somehing 0 0 46.12847797 0 943991
201607 somehing 0 0 0 0 935029
201608 somehing 0 0 0 0 899158
201609 somehing 0 0 0 0 127633
201610 somehing 0 0 0 0 0
201611 somehing 0 0 0 0 0
201612 somehing 0 0 0 0 0
201613 somehing 0 0 0 0 0
201614 somehing 0 94.71177518 0 0 0