I'm looking for a way to iterate over dataframe in R, and add to each observation few variables, taken from another dataframe. My data is as follows:
I have a dataframe of reviews that users have done on different products. For example, an observation in this dataframe includes the following fields: user_id, product_id, time_of_review, length_of_review, and other attributes of the reviewing action. Note that a user can post a review only once on each product (if at all) so the combination of user_id and product_id is unique. I want to go over this dataframe, and complete some information from another dataframe. This other dataframe contains observations of user's attributes. Each observation contains user_id and product_id, as well as other fields regarding the review that this user posted on this product. So I need to iterate over the original dataframe, and for each combination of user_id-product_id I need to go to the other dataframe and extract the additional fields, and add them to the original. How can I do it in a proper way?