I have a dataframe similar to this (although more complex):
id <- rep(1:2, each = 4)
Cond <- rep(c("test", "test","form", "form", "form", "form", "test","test"))
df <- data.frame(id,Cond)
I would like to create a third variable in my dataframe that tells me the order of Cond for each ID. For example, the first participants had first the test and then the form. In the end, the dataframe would look like this:
id Cond order
1 test test-form
1 test test-form
1 form test-form
1 form test-form
2 form form-test
2 form form-test
2 test form-test
2 test form-test
Any help would be much appreciated