I have two dataframes in my program, one of which stores the information about purchases (including product IDs), the other stores information about products, (product IDs and brand names(as factor)) I want to add to 1st dataframe column with brand names for each product. I want something like:
purchases$brand <- products[purchases$product_id == products$id,]$brand