I have the following data:
structure(list(id = c(174L, 187L, 188L, 190L, 213L, 234L), p7 = c(1L,
1L, NA, 1L, 0L, 1L), p4 = c(1L, NA, NA, 1L, 1L, 1L), p3 = c(1L,
1L, 1L, 1L, NA, 1L), p6 = c(1L, NA, NA, 1L, 1L, 1L), p1 = c(1L,
1L, 1L, 1L, NA, 1L), p2 = c(1L, 1L, 1L, 1L, 1L, 1L), p5 = c(1L,
0L, NA, 1L, NA, 1L), p8 = c(1L, NA, NA, 1L, 1L, 1L), q1 = c(1L,
1L, NA, NA, NA, NA), q2 = c(NA, NA, 0L, NA, NA, NA), q3 = c(1L,
1L, 1L, NA, 0L, 0L), q4 = c(NA, NA, NA, 0L, 0L, 0L), q5 = c(NA,
1L, 0L, 1L, 0L, 1L), q6 = c(1L, NA, 1L, 1L, 0L, NA), q7 = c(0L,
NA, 0L, 0L, NA, 1L), q8 = c(1L, NA, 0L, 0L, 0L, 0L)), .Names = c("id",
"p7", "p4", "p3", "p6", "p1", "p2", "p5", "p8", "q1", "q2", "q3",
"q4", "q5", "q6", "q7", "q8"), row.names = c(NA, 6L), class = "data.frame")
and I need a data frame where the first column contains the id
repeated 8 times, the second column contains all the values labelled with p
(in that order), and the third column contains all the values labelled with q
(in that order). I need this so I can perform pairwise comparisons between corresponding p
s and q
s data points.
Any hints?