I have following data frames
> head(elo)
date elo
1 1921-12-18 1597
2 1922-05-14 1583
3 1922-05-28 1595
4 1922-09-03 1595
5 1922-10-01 1612
6 1923-06-03 1597
[...]
> head(coaches)
surname start stop
Smith 1921-12-18 1922-05-28
White 1922-06-01 1923-06-28
Black 1923-09-13 1928-01-01
Output should looks like:
date elo coach
1 1921-12-18 1597 Smith
2 1922-05-14 1583 Smith
3 1922-05-28 1595 Smith
4 1922-09-03 1595 White
5 1922-10-01 1612 White
6 1923-06-03 1597 White
[...]
How can I assign coaches$surname to elo rows based on start and stop columns? Intervals in coaches dataframe are not overlapping.
1 Answer