I'm trying to see if any person endorsed the same response option for each item on a scale. If the person did do that, I want to create a new variable in the dataset that has a 1 in their row, and a 0 if they didn't. There are 4 rows of NAs in the columns I'm using, and I don't want to delete the rows.
I've tried ifelse(rowVars(dro[cols]) == 0, 1, 0) but the 4 NAs get removed, so I can't place the result back into the original dataset. I've tried rowMins and rowMaxs, which end up somehow shifting the NAs 4 rows up. I've also tried apply() which does the same thing as rowMins.
If anyone has any advice on how to proceed, I would be very appreciative.