Imagine a DT:
Variable1 <- c("Name1", "Name2", "Name3", "Name4", "NA", "NA", "Name5", "Name6")
Variable2 <- c("C", "C", "N", "C", "C", "C", "N", "C")
Variable3 <- c("NA", "NA", "NA", "YES", "NO", "NotApplicable", "NA", "NA")
DT <- data.table(Variable1, Variable2, Variable3)
DT
Variable1 Variable2 Variable3
1: Name1 C NA
2: Name2 C NA
3: Name3 N NA
4: Name4 C YES
5: NA C NO
6: NA C NotApplicable
7: Name5 N NA
8: Name6 C NA
I need to obtain a DT containing: Name4 C YES, NO, NotApplicable (in one row) is it possible by iteration over Variable1?