I have two dataframes:
dim(df1) = 70, 2
Item Freq
Q1 1
Q12 2
Q26 3
dim(df2) = 3780 , 2
Item Freq
Q1 1
Q1 NA
Q1 NA
Q1 NA
Q1 NA
Q1 NA
Using the ifelse function, I am trying to take the factor of df1$Item and assign it to df2$Freq, however as you can see, only the first item is populated for each Item in df2, the rest becomes NA. The code I tried:
df2$Freq <- ifelse(df1$Item == df2$Item, df1$Freq, df1$Freq)
Is there a way to tell the function that I want all items that match populated in df2? Or is there another function that would achieve this? Thanks.