I have a data frame with 2 columns, ID number and brand: 

```
X1     X2
1234   A89
1234   A87
1234   A87
1234   A32
1234   A27
1234   A27
1235   A12
1235   A14
1235   A14
1236   A32
1236   A32
1236   A27
1236   A12
1236   A12
1236   A14
1236   A89
1236   A87
1237   A99
1237   A98

```

I want to find the top 3 brand combinations that occur together most frequently with regard to id number:

```
A89, A87
A32, A27
A12, A14

```

I tried:
 library(dplyr)

```
 df %>% 
  group_by(X1,X2) %>%
  mutate(n = n()) %>%
  group_by(X1) %>%
  slice(which.max(n)) %>%
  select(-n)

```

But it doesn't work correctly. I would appreciate any thoughts or ideas!