I have a dataframe like this say n
id subject
-------------
1 discount less
2 product good
3 product good
4 wonderful service
5 discount less
and another dataframe say p like this
Subject Rate
----------------
product good 20
wonderful service 30
discount less 10
i want the output as :
id subject rate
--------------------
1,5 discount less
2,3 product good
4 wonderful service
if I match like p$id <- n$id[match(p$subject,n$subject)]
then only the first element matched will be shown...but i want all the ids....
Can anyone guide me on this