I have a df with English Premier League team ratings and another df with the full season schedule. I wish to be able to attach to the schedule df each team's rating as a variable so I can produce the probabilities per game. A step later would be to simulate the entire season.
I have tried to write an if statement to match character strings of df_1 to df_2 but I do not believe I am on the right path.
I am sure this is low level coding to most and I appreciate the help. I tried working on it before coming here. I sincerely thank you.
vec_1 <- c("team_a", "team_b", "team_c")
vec_2 <- c(1.7, 1.2, 0.8)
vec_3 <- c("team_d", "team_e", "team_f")
vec_4 <- c(0.3, 0.5, 0.4)
# df_1 ratings df
df_1 <- data_frame(team = vec_1, rating = vec_2)
 team   rating
  <chr>   <dbl>
1 team_a    1.7
2 team_b    1.2
3 team_c    0.8
# df_2 schedule df
df_2 <- data_frame(home_tm = vec_1, away_tm = vec_3)
  home_tm away_tm
  <chr>   <chr>  
1 team_a  team_d 
2 team_b  team_e 
3 team_c  team_f 
Desired outcome:
  home_tm away_tm home_tm_rat away_tm_rat
  <chr>   <chr>         <dbl>         <dbl>
1 team_a  team_d          1.7           0.3
2 team_b  team_e          1.2           0.5
3 team_c  team_f          0.8           0.4
......
......
......
 
     
    