I would like to use library(data.table) in r to efficiently replace values of datatable1 against another datatable2. Both datatables have 2mil+ records.
For example (simplified form): datatable 1 looks like-
Source Target Col1 Col2
277 266 a b
260 277 b s
276 277 d c
265 258 a v
259 258 d s
262 262 d x
270 274 e q
273 277 f w
datatable 2:
ToBeMapStr LookUpValue
256 1
257 2
258 3
259 4
260 5
261 6
262 7
263 8
264 9
265 10
266 11
267 12
268 13
269 14
270 15
271 16
272 17
273 18
274 19
275 20
276 21
277 22
The desired output in data.table1 should be:
Source Target Col1 Col2
22 11 a b
5 22 b s
21 22 d c
10 3 a v
4 3 d s
7 7 d x
15 19 e q
18 22 f w