I am trying to join two tables of unequal lengths in R. Both share a column (LogsheetID) on which to join. The longer table has more than 1 value in the other columns for each value of shared column. The shorter table has one value in columns (e.g. Date, VesselID) for each LogsheetID. In the joined table I want the values in the columns from short table be repeated according to the way LogsheetID is repeated in the long table. Tried left_join but values in joined columns from short table are NA
Asked
Active
Viewed 149 times
-4
-
1Are arguments `by`, `by.x` and `by.y` insufficient? – Roman Luštrik Dec 17 '15 at 21:07
-
Left join works for me. Show your data! (Use `dput()` to share you data. [See here](http://stackoverflow.com/q/5963269/903061) for more tips on making working exmaples) – Gregor Thomas Dec 17 '15 at 21:16
-
Thanks, Roman. by, by.x and by.y worked but only for 95 of 76000 observations. Left_join only join the tables but NA's for values in columns from shorter tables. Merge places tables on top of one another with NA's for values of respective tables. dput() to show my data failed me, don't know how. – Uatjavi Uanivi Dec 18 '15 at 12:03
-
1You need to show the code you are using (with some sample data would help). Left join can work for this problem, but unless you show what you tried we can't tell you what you are doing wrong. This is the reason people are down-voting your question. – Gregor Thomas Dec 18 '15 at 17:59
-
My problem was inconsistency in my raw data. Once I cleaned my Access database the problem was sorted, Thanks. – Uatjavi Uanivi Dec 19 '15 at 20:48