r - roll join of two non-overlapping `data.table`s -
There are two non-overlapping data.tables and include a rolling:
library ( P = data eligible (id = c ("a", "a"), t = c (1,4), txn = c (0, 0), key = c ("id", " T = "") TX = DataTable (id = c ("a"), t = c (3), txn = c (1111), key = c ("id", "t")) #note index t = 3 P # id T TNN # 1: A11111 # 2: A4 0 P = [Tx, TxN: = ITN.N, roll = TRUE] falls into the ditch. <<< >> << code> txn previous available index ( t = 1 ) when roll> 0 I hope it will be brought in a next available ( t = 4 )? P # Expected # id t txn # 1: a 1 0 # 2: a 4 1111
to ? In the form of data roll = TRUE and i S matches all, but the last x is in the Combination column, and its price is the last i In (that group is included after the last observation in x ), then the prevailing value in X is forwarded. Here, the value from TX (= i) is T = 3, T = 1 and T = 4 to P In the middle of the difference. And so this match is prevailing value in P (= x) T = 1, and this line is the first line you can do this: P [TX, J = TRUE, roll = IP] # # roll = TRUE, LOCF # [1] 1 P [TX, J = TRUE, roll = -inf] ## NOCB # [1] 2 Does this answer your question?
Comments
Post a Comment