I want to group rows of my data frame. But the columns should not be summarized, I want to attach them.
I tried the tidyverse package and came to a close (wrong) solution.
This is my df:
`Order ID` Quantity `Sub-Category 1` `Sub-Category 2` `Sub-Category 3` `Sub-Category 4` `Sub-Category 5` `Sub-Category 6`
<chr> <dbl> <chr> <chr> <chr> <chr> <chr> <chr>
1 22 2 Bookcases Bookcases NA NA NA NA
2 33 3 Chairs Chairs Chairs NA NA NA
3 22 2 Labels Labels NA NA NA NA
4 33 5 Tables Tables Tables Tables Tables NA
The number of columns represent the Quantity, so Quantity column not longer needed. I want to group them and attach the same Order ID rows, to get this solution:
`Order ID` Quantity `Sub-Category 1` `Sub-Category 2` `Sub-Category 3` `Sub-Category 4` `Sub-Category 5` `Sub-Category 6`
<chr> <dbl> <chr> <chr> <chr> <chr> <chr> <chr>
1 22 2 Bookcases Bookcases Labels Labels NA NA
2 33 3 Chairs Chairs Chairs Tables Tables Tables Tables Tables
Thank you very much, appreciate your help.