Here are two dataframe. How is it possible to use te productid of the second to merge the two dataframe but the first dataframe contains more rows and in some of them there must be in text column NA
dframe1 = data.frame(sample = c("text1", "text2", "text3", "text4", "text5", "text6", "text7", "text8", "text9", "text10"),
productid = c(33, 5, 33, 34, 12, 54, 22, 9, 45, 22),
manifucturerid = c(1, 1, 2, 2, 3, 4, 5, 6, 7, 7))
dframe2 = data.frame(productid = c(33, 33, 34, 54, 22, 45, 22),
text = c("a,b", "a,b", "c,d", "e,f,g", "h,i,j,k", "l,m", "h,i,j,k"))
Example of expected output
dframe = data.frame(sample = c("text1", "text2", "text3", "text4", "text5", "text6", "text7", "text8", "text9", "text10"), productid = c(33, 5, 33, 34, 12, 54, 22, 9, 45, 22),
manifucturerid = c(1, 1, 2, 2, 3, 4, 5, 6, 7, 7),
text = c("a,b", "NA", "a,b", "c,d", "NA", "e,f,g", "h,i,j,k", "NA", "l,m", "h,i,j,k"))