This is a reproducible example of making a left_join() (which means you can simply copy the code as it is and make it work on your computer). Try to make one that shows your issue.
library(dplyr)
# Sample data on a copy/paste friendly format
nba_salary <- data.frame(
stringsAsFactors = FALSE,
Players = c("Stephen Curry","Chris Paul","Russell Westbrook",
"John Wall","James Harden","LeBron James",
"Kevin Durant","Blake Griffin","Kyle Lowry",
"Paul George"),
Salary = c(40231758,
38506482,38178000,37800000,37800000,
37436858,37199000,34234964,33296296,33005556),
Rank = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
)
nba_stats <- data.frame(
stringsAsFactors = FALSE,
Players = c("Stephen Curry","Chris Paul","Russell Westbrook",
"John Wall","James Harden","LeBron James",
"Kevin Durant","Blake Griffin","Kyle Lowry",
"Paul George"),
some_stat = rnorm(10)
)
# Relevant code
nba_stats %>%
left_join(nba_salary, by = "Players")
#> Players some_stat Salary Rank
#> 1 Stephen Curry 0.01482341 40231758 1
#> 2 Chris Paul -0.18417913 38506482 2
#> 3 Russell Westbrook -0.42616613 38178000 3
#> 4 John Wall -0.63422415 37800000 4
#> 5 James Harden 1.34669284 37800000 5
#> 6 LeBron James -0.65364381 37436858 6
#> 7 Kevin Durant -0.69911135 37199000 7
#> 8 Blake Griffin 0.75686720 34234964 8
#> 9 Kyle Lowry -1.34995016 33296296 9
#> 10 Paul George 0.59446418 33005556 10
Created on 2020-11-01 by the reprex package (v0.3.0.9001)