I have:
inputDT <- data.table(COL1 = c(1, NA, NA), COL1 = c(NA, 2, NA), COL1 = c(NA, NA, 3))
inputDT
COL1 COL1 COL1
1: 1 NA NA
2: NA 2 NA
3: NA NA 3
I want
outputDT <- data.table(COL1 = c(1,2,3))
outputDT
COL1
1: 1
2: 2
3: 3
Essentially, I have a data.table with multiple columns whose names are the same (values are mutually exclusive), and I need to generate just one column to combine those.
How to achieve it?