Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate player hrefs in FBref functions #332

Merged
merged 3 commits into from
Sep 27, 2023
Merged

Conversation

tonyelhabr
Copy link
Collaborator

It was possible for FBref functions that returned Player_Href (added with #328) to return "bad" links when there are different players with the same exact name. This is fixed by simply joining the hrefs back to the rest of the dataframe rather than doing a lookup by name. The new approach may encounter an error if a player does not have an FBref page for some reason, although I've never actually seen that before.

Fixes #327.

@@ -48,7 +48,7 @@
return(tibble::tibble())
}
renamed_table <- .rename_fb_cols(tables[[3]])
renamed_table[renamed_table$Rk != "Rk", ]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive by fix... this should have been assigned back to renamed_table 😅

res <- dplyr::mutate(
df,
"Player_Href" = players[df$Player],
"Player_Href" = player_hrefs,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assumes the number of player links will be equal to the number of rows in df. this is probably a fine assumption

@tonyelhabr tonyelhabr marked this pull request as draft September 26, 2023 01:34
@codecov-commenter
Copy link

Codecov Report

Merging #332 (0dd8d24) into main (8410368) will decrease coverage by 0.10%.
The diff coverage is 75.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main     #332      +/-   ##
==========================================
- Coverage   63.18%   63.09%   -0.10%     
==========================================
  Files          44       44              
  Lines        3583     3582       -1     
==========================================
- Hits         2264     2260       -4     
- Misses       1319     1322       +3     
Files Coverage Δ
R/get_advanced_match_stats.R 37.96% <100.00%> (-0.33%) ⬇️
R/fb_league_stats.R 76.47% <0.00%> (ø)

... and 2 files with indirect coverage changes

@tonyelhabr tonyelhabr marked this pull request as ready for review September 26, 2023 02:02
Copy link
Owner

@JaseZiv JaseZiv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tonyelhabr tonyelhabr merged commit 8a10424 into main Sep 27, 2023
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fb_player_match_logs with duplicate end years
3 participants