The optimal solution using data.table
library(data.table)
setDT(foo)
setDT(bar)
foo[bar, on="index", value:=i.value]
foo
# index value
#1: a 100
#2: b 101
#3: c 200
#4: d 201
first argument in [
data.table method is named i
thus we can refer to column from table in i
argument using i.
prefix.