I have two dataframes (df1, df2).
df1 <- data.frame(term = c("A", "B", "C", "D", "E", "F"))
df2 <- data.frame(term = c("C", "F", "G"), freq = c(7, 3, 5))
In df1, I want to add a column ("freq") based on the values of "freq" in df2. So if the term in df1 and the term in df2 match, the count ("freq") of this term should be added to df1. Else it should be "0" (zero).
How can I do it, so that the processing time is as small as possible? Is there a way how to do it with dplyr? I cannot figure it out!!!