I have seen some fairly similar questions answered here, however, my brain is having some trouble making the leap to apply what I read directly to my data.
I would like
One way is join on
'input' and then assign the value to 'output
library(data.table)
setDT(dfMeasured)[dfRef, output := output - i.output,on = .(input)]
dfMeasured
# input output group
# 1: 0 0 A
# 2: 1 -2 A
# 3: 2 1 A
# 4: 3 0 A
# 5: 0 -2 B
# 6: 1 -4 B
# 7: 2 -3 B
# 8: 3 7 B
# 9: 0 -3 C
#10: 1 -3 C
#11: 2 -6 C
#12: 3 8 C