I have data like this:
& gt; DT & LT; -Data qualified (F = representative (C ('A', 'B', 'C'), each = 2), fine = C (10:15), A = C (1: 6), B = C 2: 7), c = c (3: 8)) gt; DT F OK ABC 1: A10 1 2 3 2: One 11 2 3 4 3: B12 3 4 5 4: B13 4 5 6 5: C14 5 6 7 6: C15 6 7 8 Column F stores the column for each row to remove it. Therefore for the first 2 record columns, the column 'A' will be removed whereas the column 'B' will be drawn for the 3 and 4 records. 'Fix' will be kept for each record. The ideal output should be like this:
F Fix new 1: one 10 1 2: one 11 2 3: b12 4 4: b13 5 5: c147 6: c15 8
using sd
to With = FALSE
dt [,. (OK = OK, new = unselected (with SD [, F, = FALSE]), by = F] ## F Fix new ## 1: one 10 ## 2: one 11 2 ## 3 : B124 ## 4: B13 5 ## 5: C147 ## 6: C158
No comments:
Post a Comment