I am very new for R programming and I have tried to swap the sequence but I am not sure that there are functions in R or other ways to swap the sequence or not.
I have vector data like this

```
yy <- c(21,22,8,24)

```

Then, I want to swap between 2 no. It starts from the first index and swapping with second and third index respectively. For example, `21` swaps with `22`, `21` swaps with `8`, `21` swaps with `24`

The result should look as follows

```
22,21,8,24

8,22,21,24

24,22,8,21

21,8,22,24

21,24,8,22

22,21,24,8

```