From the following data frame, I want to get unique elements from the f1 column based on the f2 column.
df <- as.data.frame(rbind(c('11061002','11862192','11083069'),
c(" ",'1234567','452589')))
df$f1 <-paste0(df$V1,
',',
df$V2,
',',
df$V3)
df_1 <- as.data.frame(rbind(c('11862192'),
c('145')))
names(df_1)[1] <-'f2'
df <- as.data.frame(cbind(df,df_1))
df <-df[,c(4,5)]
The expected output is the third column with values: 11061002,11083069 as 11862192 was present in both. ,1234567,452589 as there is not 145 present in the second column.
Please guide.