I have a dataframe:
> df <- data.frame(ID=c('1','1','1','1','1'), Type=c('a','a','b','c','c'), value=c(10,2,5,3,7))
ID Type value
1 1 a 10
2 1 a 2
3 1 b 5
4 1 c 3
5 1 c 7
I want to split it into a list of subgroups, so that each subgroup will contain 2 Types.
So subgroup1 will have Type a and b
ID Type value
1 1 a 10
2 1 a 2
3 1 b 5
and subgroup2 will have Type b and c
ID Type value
3 1 b 5
4 1 c 3
5 1 c 7
and subgroup3 will have Type c and d ..... and so on
Is there any way to do that?