So I have two data frames, info and towers, with examples in the following:
Info:
ID Date
1132 01/09/2015
1156 02/09/2015
1132 04/09/2015
1101 04/09/2015
Towers:
Tower ID1 ID2
1 1132 1101
2 1520 1156
The values in the ID column of Info will always match either ID1 or ID2 in Towers. I want to join the frames based on that information, so my joined frame should be:
ID Date Tower
1132 01/09/2015 1
1156 02/09/2015 2
1132 04/09/2015 1
1101 04/09/2015 2
I know dplyr's semi_join makes something like what I need, but I understand it requires a match in both value and column name. Given that these columns have different names, I don't know if it will work properly. Is there a method I could use here?
melt
Towers so your IDs are in the same column – SymbolixAUas.Date
and learn to format those properly. Also, please make your example reproducible next time so it can be copy-pasted in by others. – Frankstructure(...)
If you copy-paste that into your R session, it will return your example data.frame. This sort of thing should be included with a question. For info on how to go about this, check out stackoverflow.com/questions/5963269/… – Frank