This is not a \"vlookup-and-fill-down\" question.
My source data is excellent at delivering all the data I need, just not in in a usable form. Recent changes in volume
We could use eat
from my package safejoin, and "patch"
the matches from the rhs into the lhs when columns conflict.
We rename Backordered
to onPO
on the way so the two columns conflict as desired.
# devtools::install_github("moodymudskipper/safejoin")
library(safejoin)
library(dplyr)
eat(inv, svc, onPO = Backordered, .conflict = "patch")
# Item onHand demand onPO
# 1 10100200 600 3300 2700
# 2 10100201 NA NA 20
# 3 10100202 39 40 1
# 4 10100203 0 40 40
# 5 10100204 NA NA 100
# 6 10100205-A NA NA 18
# 7 10100206 40 70 30
# 8 10100207 0 126 126
# 9 10100208 0 10 10
# 10 10100209 0 10 10
# 11 10100210 0 250 250