[R] Merging two data frame with different lengths

Abraham Mathew mathewanalytics at gmail.com
Fri Jun 10 18:14:49 CEST 2016


So I have two data frames.

The first one is a reccomendation data frame and the second is a melted
list with a pairing of OpportunityId's and ProductId's. There are multiple
product id's per an opportunty id. What I want to do is merge based on
ProductId so that I can add the OpportunityId to the reccomendation data
frame.

> head(product_neighbours_orig[,1:3],2)           ProductId   Reccomendation_1   Reccomendation_2
1 01t30000001ik30AAA 01ta0000005SivAAAS 01ta0000005RQimAAG
2 01t30000001ik3vAAA 01t30000001ik5bAAA 01t30000001ikKPAAY>
head(pd_melt[,1:3],2)          OpportunityId          ProductId value
4826 0063000000bqUKlAAM 01t30000001ik3vAAA     0
9651 0063000000bqUKlAAM 01t30000001ik41AAA     0





Any suggestions?

-- 


*Abraham MathewData Ninja and Statistical Modeler*



*Minneapolis, MN720-648-0108 at abmathewksAnalytics_Blog
<https://mathewanalytics.wordpress.com/>*

	[[alternative HTML version deleted]]



More information about the R-help mailing list