I’d like to create a column that tells me whether or not a group are sitting next to each other.
To visualise, my ideal output would be:
Group Number | Seat | consecutive? |
---|---|---|
1 | A | Y |
1 | B | Y |
1 | C | Y |
2 | B | N |
2 | E | N |
I’ve tried using cumsum() and ave() inspired by other answers but I cant seem to make it do what I’m after.