I have 2 dataframes. One is a more up to date inventory list (Product, Quantity), and one is an older inventory list.
I am trying to figure out the most efficient way to produce a list of all new product (product that is in the new list but not the old one. This can either be a brand new product, or an addition to the "Quantity" variable with the same Product).
I am also looking for the opposite - essentially trying to produce a list of all "lost" product (product that is completely removed or quantity goes down)
I tried doing some anti joins/inner joins with no luck. Anyone have any suggestions on an efficient way to do this in R?
Datasets:
n<-6
new <- data.frame(quantity=1:n,
product=rep(LETTERS[1:6], n/6)
)
n<-4
old <- data.frame(quantity=1:n,
product=rep(LETTERS[1:4], n/4)
)
here, the result would be 5/E and 6/F as new products, and nothing in the lost products