I have a 2X2 design (it's more complex, but below a simple example to illustrate my issue).
Say my output data looks like this:
In the image, ID is each participant, block number is the condition they saw, and everybody saw 4 questions.
Where the counterbalancing plays a role (for example) is that the same item (e.g, Item1) was repeated in different positions between Q1-Q4 across participants depending on the block. In the picture above, Item1 would be the red numbers. I used case_when to pull out the combinations and give me a clean column of the Item1 responses:
data <- data %>% mutate(
Item1= case_when(
BlockNumber == 'Block1' & Q1 ~ Q1,
BlockNumber == 'Block5' & Q2 ~ Q2,
BlockNumber == 'Block6' & Q3 ~ Q3,
BlockNumber == 'Block7' & Q4 ~ Q4))
This gives me something like:
The code is doing exactly what I need it to, BUT the ZERO VALUES are getting dropped [highlighted in the picture].
Instead of a zero, it is just an NA value. Something like this: enter image description here
The problem is that zeros are meaningful in my data and I need to keep them.
Does anyone have an idea of what code I could add/use to avoid this? It really messes up my mean scores afterwards because the zeros are dropped.