Hello RStudio community,
How to create a dummy column from multiple dummy columns. I would like to create a new dummy column (x5) from column x1-x4 in below dataset. In order that x5=1 If any rows has 1, x5=0 if any rows has 0, but not 1, otherwise NA. If anybody can help me. Appreciate it.
data <- data.frame (sn = 1:6,
x1 = c(NA,1L,0L,NA,1L,0L),
x2 = c(1L,NA,0L,NA,1L,1L),
x3 = c(0L,1L,0L,NA,0L,0L),
x4 = c(1L,NA,0L,NA,1L,1L)
)