DATA = data.frame(x1=c("dog","cat","fox","mouse",NA,NA),
x2=c("dog","cat","rhino", NA, "cat","fox"),
x3=c("dog","cat",NA,NA,"cat","fox"),
WANT=c("dog","cat","fox","mouse","cat","fox"))
I have 'DATA' with x1, x2, x3 and I wish to collapse x1, x2, x3 into 'WANT' which just takes the first reported value starting from x1, using data.table